Delphi我写的类似功能带历史记忆,并模糊带出功能的Edit


 先在ListBox1的Items里添加数据

(20) Lazarus学习之ListFilterEdit1过滤ListBox1数据CheckListBox1,ColorListBox1,FileListBox1_Text

 再拖一个ListFilterEdit1到界面上,设置它的FilteredListBOx设为ListBox1即可,同样也可以设置 是否 大小写 敏感,从头开始匹配等

(20) Lazarus学习之ListFilterEdit1过滤ListBox1数据CheckListBox1,ColorListBox1,FileListBox1_添加数据_02

 即可看到过滤效果

(20) Lazarus学习之ListFilterEdit1过滤ListBox1数据CheckListBox1,ColorListBox1,FileListBox1_大小写_03

 

(20) Lazarus学习之ListFilterEdit1过滤ListBox1数据CheckListBox1,ColorListBox1,FileListBox1_大小写_04

 获得选中行

procedure TForm1.ListBox1KeyPress(Sender: TObject; var Key: char);
begin
  if (key=#13) and (ListBox1.Items.Count>0) then begin 
   ListFilterEdit1.Text:= ListBox1.Items[ListBox1.ItemIndex];
   ListFilterEdit1.SetFocus;
end
end;

 


同样适合CheckListBox1

(20) Lazarus学习之ListFilterEdit1过滤ListBox1数据CheckListBox1,ColorListBox1,FileListBox1_添加数据_05

(20) Lazarus学习之ListFilterEdit1过滤ListBox1数据CheckListBox1,ColorListBox1,FileListBox1_Text_06

同样适合ColorListBox1

(20) Lazarus学习之ListFilterEdit1过滤ListBox1数据CheckListBox1,ColorListBox1,FileListBox1_添加数据_07

(20) Lazarus学习之ListFilterEdit1过滤ListBox1数据CheckListBox1,ColorListBox1,FileListBox1_Text_08

同样适合FileListBox1

(20) Lazarus学习之ListFilterEdit1过滤ListBox1数据CheckListBox1,ColorListBox1,FileListBox1_Text_09

(20) Lazarus学习之ListFilterEdit1过滤ListBox1数据CheckListBox1,ColorListBox1,FileListBox1_Text_10