Vcl.ComCtrls.TCustomListView.OnCompare

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property OnCompare: TLVCompareEvent read FOnCompare write FOnCompare;

C++

__property TLVCompareEvent OnCompare = {read=FOnCompare, write=FOnCompare};

Properties

Type Visibility Source Unit Parent
event protected
Vcl.ComCtrls.pas
Vcl.ComCtrls.hpp
Vcl.ComCtrls TCustomListView

Description

Occurs when two items need to be compared during a sort of the list.

Write an OnCompare event handler to implement a sort order for the list. An OnCompare event handler is called when the SortType property is stData or stBoth, when the AlphaSort method is called, or when the CustomSort method is called without a SortProc parameter.

The OnCompare event handler compares the list items passed as the Item1 and Item2 parameters. If Item1 is the same as Item2 in the sort order, set the Compare parameter to 0. If Item1 is less than Item2, set the Compare parameter to a value less than 0. If Item1 is greater than Item2, set the Compare parameter to a value greater than 0.

OnCompare is an event handler of type Vcl.ComCtrls.TLVCompareEvent.

See Also

Code Examples