Sub OnSearch(Sender: Object; Args: ITreeSearchNodeEventArgs);
Begin
//set of operators;
End Sub OnSearch;
Sub OnSearch(pSender: System.Object; pArgs: Prognoz.Platform.Interop.Forms.TreeSearchNodeEventArgs);
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.
The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.
Imports Prognoz.Platform.Forms.Net;
Public Partial Class TESTForm: Prognoz.Platform.Forms.Net.ForeNetForm
Public Constructor TESTForm();
Begin
InitializeComponent();
End Constructor;
Private Sub treeListNet1_OnBeginSearch(pSender: System.Object; pArgs: Prognoz.Platform.Interop.Forms.TreeSearchEventArgs);
Begin
System.Diagnostics.Debug.WriteLine("Search by text: " + pArgs.SearchText);
End Sub;
Private Sub treeListNet1_OnSearch(pSender: System.Object; pArgs: Prognoz.Platform.Interop.Forms.TreeSearchNodeEventArgs);
Begin
If pArgs.Node.Text.IndexOf("Old") <> -1 Then
pArgs.Show := False;
End If;
End Sub;
End Class;
See also: