» Help

Incremental search of list box

   

The following code implements incremental search of list box using text typed into edit control.

procedure TListBoxSearchForm.Edit1Change(Sender: TObject) ;
const
  indexStart = -1;
var
  search : array[0..128] of Char;
begin
  //make sure Length(Edit1.Text) <= 128
  StrPCopy(search, Edit1.Text) ;
  ListBox1.ItemIndex := ListBox1.Perform(
    LB_SELECTSTRING, indexStart, LongInt(@search)
  );
end;
Author: Unknown
Added: 2007-06-02
Last updated: 2007-06-02

« Return to contents »