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