其他分享
首页 > 其他分享> > Delphi XE5的新功能“ TListView内置搜索过滤”

Delphi XE5的新功能“ TListView内置搜索过滤”

作者:互联网

在窗体的OnCreate事件中初始化TListView项。   procedure TForm1.FormCreate(Sender: TObject); const   Books: array [0 .. 4] of string = (     'Delph abc',     'Delphi XE2入门',     ' by DelphiXE',     'Delphi 2009 handbook'); var   Book: string; begin   for Book in Books do   begin     ListView1.Items.Add.Text := Book;   end; end; 在Button1的OnClick事件中执行搜索过滤。   procedure TForm1.Button1Click(Sender: TObject); var   SearchResponder: ISearchResponder; begin   SearchResponder := ListView1 as ISearchResponder;   SearchResponder.SetFilterPredicate(     function(Arg: string): Boolean     begin       Result := Arg.StartsWith('Delphi');     end); end;

标签:begin,end,string,TListView,Delphi,XE5,Book,SearchResponder
来源: https://www.cnblogs.com/jijm123/p/14009596.html