【问题标题】:Delphi XE5 Android. ListView setting SearchString?德尔福 XE5 安卓。 ListView 设置 SearchString?
【发布时间】:2013-10-22 13:42:17
【问题描述】:
我需要在 Delphi FM.Android TListView 中设置搜索字符串。
当我设置 ListView.SearchVisible = true 时显示此框。
但是没有像“SerchString”这样的属性。我怎样才能重新使用它或在代码中设置它?是否可以?如果没有,可能是其他一些过滤ListView的方法吗?
【问题讨论】:
标签:
android
android-listview
delphi-xe5
firemonkey-fm3
【解决方案1】:
如果我理解你的问题,
它是自动工作的,只需在列表框上添加一些项目并尝试搜索框,它将在项目的 itemtext 上工作,并仅显示您在搜索框中输入的过滤字符串的项目。
【解决方案2】:
function FindSearchBox(const ARootControl: TControl): TSearchBox;
var
Child: TControl;
begin
Result := nil;
for Child in ARootControl.Controls do
if Child is TSearchBox then
Exit(TSearchBox(Child));
end;
procedure TFormAdd.SpeedButton1Click(Sender: TObject);
var
SearchBox: TSearchBox;
begin
SearchBox:=FindSearchBox(FormMain.ListView1);
if SearchBox <> nil then
begin
SearchBox.Text:=''; // set text here
end;
end;