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

# TLVCompareEvent

Specifies an event handler signalled to compare two items in a List View control.

## Declaration

Source position: comctrls.pp line 1311

`type TLVCompareEvent = procedure(`
`Sender: TObject;`
`Item1: TListItem;`
`Item2: TListItem;`
`Data: Integer;`
`var Compare: Integer`
`) of object;`

## Arguments

`Sender` |  | Object generating the event notification. It must be cast to the TCustomListView type to access properties or methods specific to the list view control.
`Item1` |  | First list item for the comparison.
`Item2` |  | Second list item for the comparison.
`Data` |  | Contains an Integer value indicating where the items or their data is used in the comparison. The value is normally 0 when signalled, indicating that the list items are used.
`Compare` |  | Indicates the relative order for the list items. Negative values indicate Item1 occurs first in the sort order. Positive values indicates Item2 occurs first in the sort order. Zero (0) indicates the list items have the same value.

## Description

TLVCompareEvent is the type used to implement the OnCompare event handler in TCustomListView, and implements the Sort method for the control.

## See also

TCustomListView.OnCompare |  | Event handler signalled to compare list items in the CustomSort method.
TCustomListView.SortType |  | Specifies the sorting mechanism used for the current SortColumn.
TCustomListView.Sort |  | Sorts the values in Items using the SortType, SortColumn, and SortDirection for the control.