Einzelnen Beitrag anzeigen

Benutzerbild von Matze
Matze
(Co-Admin)

Registriert seit: 7. Jul 2003
Ort: Schwabenländle
14.929 Beiträge
 
Turbo Delphi für Win32
 
#12

Re: Editfeld mit Dropdownmenü

  Alt 24. Dez 2009, 15:03
Wir haben die Parameter bei Pos() vertauscht. So funktioniert's bei mir (soeben getestet):

Delphi-Quellcode:
procedure TForm1.Autocomplete(Combobox: TComboBox);
var
  EntryNum: Integer;
  EntryValue: string;
  statistic: TiniFile;
  i: Integer;
begin
  statistic := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'statistic.ini');
  try
    // read number of entries
    EntryNum := statistic.ReadInteger('Playerlist', 'count', 0);

    Combobox.Items.Clear;
    Combobox.Items.BeginUpdate;

    // add items
    for i := 1 to EntryNum do
    begin
      EntryValue := statistic.ReadString('Playerlist', IntToStr(i), '');

      if ((EntryValue <> '') and (Pos(LowerCase(Combobox.Text), LowerCase(EntryValue)) = 1)) then
      begin
       Combobox.Items.Add(EntryValue);
      end;
    end;

    Combobox.Items.EndUpdate;
  finally
    FreeAndNil(statistic);
  end;
end;
Grüße, Matze
  Mit Zitat antworten Zitat