[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'ComCtrls' (#lcl)

# TCustomListView.OnCompare

Event handler signalled to compare list items in the CustomSort method.

## Declaration

Source position: comctrls.pp line 1605

`protected property TCustomListView.OnCompare : TLVCompareEvent read FOnCompare write FOnCompare;`

## Description

OnCompare is a TLVCompareEvent property with the event handler signalled to compare the values for list items. Arguments passed to the event handler identify the list view control, the items compared in the handler. The relative sort order for the compared items is returned in a variable parameter passed to the handler.

OnCompare is signalled (when assigned) when the Sort method is called, or when CustomSort is called without specifying a custom sort function.

## See also

TCustomListView.Sort |  | Sorts the values in Items using the SortType, SortColumn, and SortDirection for the control.
TCustomListView.CustomSort |  | Sorts the Items for the list view control using the specified procedure or the OnCompare event handler.
TLVCompareEvent |  | Specifies an event handler signalled to compare two items in a List View control.