Sub OnFilter(Sender: Object; Args: ITreeSearchNodeEventArgs);
Begin
//set of operators;
End Sub OnFilter;
Sender. Parameter that returns the component that generated the event.
Args. Parameter that enables the user to determine event parameters.
The OnFilter event occurs after the list of components is filtered.
This event occurs for each found element, which is finally put to the filtered list of elements. It is possible to control the display of element in the filtered list by means of the Show property.
Executing this example requires a form and the TreeCombo component on it. The OnBeginFilter and OnFilter event handlers are set for the component.
Class TESTForm: Form
TreeCombo1: TreeCombo;
Sub TreeCombo1OnBeginFilter(Sender: Object; Args: ITreeSearchEventArgs);
Begin
Debug.WriteLine("Filtering by text: " + Args.SearchText);
End Sub TreeCombo1OnBeginFilter;
Sub TreeCombo1OnFilter(Sender: Object; Args: ITreeSearchNodeEventArgs);
Begin
If Args.Node.Text.IndexOf("Old") <> -1 Then
Args.Show := False;
End If;
End Sub TreeCombo1OnFilter;
End Class TESTForm;
If the component is focused, its list is collapsed and characters are entered, the elements list is filtered. The text, by which filtering is executed, is displayed in the development environment component. If the element contains the text "Old" in its name, such elements are hidden in the final list. After filtering the obtained elements list is displayed.
See also: