FMX.ListView.TListView.OnSearchChange
Delphi
property OnSearchChange: TNotifyEvent read FOnSearchChange write FOnSearchChange;
C++
__property OnSearchChange;
Propriétés
Type | Visibilité | Source | Unité | Parent |
---|---|---|---|---|
event | published | FMX.ListView.pas FMX.ListView.hpp |
FMX.ListView | TListView |
Description
Survient quand la zone de recherche dans une vue liste perd la focalisation et que son contenu a changé depuis qu'elle a reçu la focalisation.
FMX.ListView.TListView.OnSearchChange hérite de FMX.ListView.TListViewBase.OnSearchChange. Tout le contenu en-dessous de cette ligne se réfère à FMX.ListView.TListViewBase.OnSearchChange.
Survient quand la zone de recherche dans une vue liste perd la focalisation et que son contenu a changé depuis qu'elle a reçu la focalisation. Cet événement expose l'événement OnChange du TSearchBox qui implémente la zone de recherche d'une vue liste.
Par exemple, l'extrait de code ci-dessous met à jour le texte contenu dans la barre d'état de cet événement pour afficher le nombre d'éléments restants dans la liste après l'application du filtre spécifié :
Delphi :
procedure TMainForm.ListViewSearchChange(Sender: TObject);
var
I: Integer;
SearchBox: TSearchBox;
List: TListView;
begin
List := Sender as TListView;
for I := 0 to List.Controls.Count-1 do
if List.Controls[I].ClassType = TSearchBox then
begin
SearchBox := TSearchBox(List.Controls[I]);
Break;
end;
StatusBar.Text := IntToStr(List.Items.Count) + ' list items match ' + QuotedStr(SearchBox.Text) + '.';
end;
C++ :
void __fastcall TMainForm::ListViewSearchChange(TObject *Sender)
{
TSearchBox* searchBox;
TListView* list = reinterpret_cast<TListView*>(Sender);
for (int i = 0; i < list->Controls->Count; i++) {
searchBox = dynamic_cast<TSearchBox*>(list->Controls->Items[i]);
if (searchBox) break;
}
MainForm->StatusBar->Text = UnicodeString(list->Items->Count) + " list items match " + QuotedStr(searchBox->Text) + ".";
}