Registriert seit: 12. Mai 2009
214 Beiträge
Turbo Delphi für Win32
|
Re: Editfeld mit Dropdownmenü
25. Dez 2009, 00:24
Delphi-Quellcode:
procedure Tform2.Autocomplete(Combobox: TCombobox);
var
EntryNum, selstart, sellength: Integer;
EntryValue: string;
statistic: TiniFile;
i: Integer;
begin
statistic := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'statistic.ini');
try
EntryNum := statistic.ReadInteger('Playerlist', 'count', 0);
selstart := ComboBox.SelStart;
sellength := ComboBox.SelLength;
Combobox.Items.Clear;
Combobox.Items.BeginUpdate;
for i := 1 to EntryNum do
begin
EntryValue := statistic.ReadString('Playerlist', IntToStr(i), '');
if (combobox.Text='') or((EntryValue <> '') and (Pos(LowerCase(Combobox.Text), LowerCase(EntryValue)) = 1)) then
begin
Combobox.Items.Add(EntryValue);
end;
end;
Combobox.Items.EndUpdate;
ComboBox.SelStart := selstart;
ComboBox.SelLength := sellength;
finally
FreeAndNil(statistic);
end;
end;
Damit klappts
Vielen Dank
|
|
Zitat
|