Sub OnCompareItems(Sender: Object; Args: ITreeControlCompareEventArgs);
Begin
//set of operators;
End Sub OnCompareItems;
The Sender parameter returns the component that has generated the event.
The Args parameter allows to determine event parameters.
The OnCompareItems event occurs when two elements are compared during the custom sorting of elements.
Executing the example requires a form, a button named Button1 on it and the TreeList component named TreeList1. The SortType property of the TreeList1 component is set to Custom value. The elements in the second column contain the integer values.
Sub TreeList1OnCompareItems(Sender: Object; Args: ITreeControlCompareEventArgs);
Var
Nod1, Nod2: ITreeListNode;
Begin
Nod1 := Args.LeftItem;
Nod2 := Args.RightItem;
If Integer.Parse(Nod1.ColumnText(1)) > Integer.Parse(Args.RightItem.ColumnText(1)) Then
Args.Compare := -1;
Else
Args.Compare := 1;
End If;
End Sub TreeList1OnCompareItems;
When the event occurs, the elements are sorted depending on the value of the element in the second column
See also: