ITreeControl.OnSearch

Syntax

Sub OnSearch(Sender: Object; Args: ITreeSearchNodeEventArgs);

Begin

//set of operators;

End Sub OnSearch;

Parameters

Sender. Parameter that returns the component that has generated the event.

Args. Parameter that enables the user to determine event parameters.

Description

The OnSearch event occurs after the element search in the component is finished.

Comments

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.

Example

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:

ITreeControl