Sub OnSearch(Sender: Object; Args: ITreeSearchNodeEventArgs);
Begin
//set of operators;
End Sub OnSearch;
Sender. Parameter that returns the component that has generated the event.
Args. Parameter that enables the user to determine event parameters.
The OnSearch event occurs after the element search in the component is finished.
This event occurs for each found element. The Show property can be used to control navigating to the found element. If the Show property is set to False, the element is skipped, and the system moves to the next found element, for which the individual OnSearch event is also generated.
Executing the example requires a form and the TreeList component on it. The OnBeginSearch and OnSearch handlers for searching elements events are set for the component.
Class TESTForm: Form
TreeList1: TreeList;
Sub TreeList1OnBeginSearch(Sender: Object; Args: ITreeSearchEventArgs);
Begin
Debug.WriteLine("Search by text: " + Args.SearchText);
End Sub TreeList1OnBeginSearch;
Sub TreeList1OnSearch(Sender: Object; Args: ITreeSearchNodeEventArgs);
Begin
If Args.Node.Text.IndexOf("Old") <> -1 Then
Args.Show := False;
End If;
End Sub TreeList1OnSearch;
End Class TESTForm;
The text, by which elements are searched, is displayed in the development environment console. If elements contain the text "Old" in its name, such elements are skipped, and the search continues by the next elements.
See also: