Sub OnCompareItems(Sender: Object; Args: IListViewCompareEventArgs);
Begin
//set of operators;
End Sub OnCompareItems;
Sender. Parameter that returns the component that generated the event.
Args. Parameter that enables the user to determine event parameters.
The OnCompareItems event occurs on comparing two elements when executing sorting in a component column.
Sub ListView1OnCompareItems(Sender: Object; Args: IListViewCompareEventArgs);
Var
It1, It2:IListViewItem;
Begin
It1 := Args.LeftItem;
It2 := Args.RightItem;
If It1.Text.Length < It2.Text.Length Then
Args.Compare:=1;
Else
Args.Compare:=-1;
End If;
End Sub ListView1OnCompareItems;
When the event is executed, the elements are sorted depending on the length of the element value.
See also: