在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
在窗体的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;
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论