Vcl.ListActns.TListControlItems.CompareItems
Delphi
function CompareItems(I1, I2: TListControlItem): Integer; virtual;
C++
virtual int __fastcall CompareItems(TListControlItem* I1, TListControlItem* I2);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | protected | Vcl.ListActns.pas Vcl.ListActns.hpp |
Vcl.ListActns | TListControlItems |
Description
Returns the relative order of two items in the collection.
CompareItems is used internally to provide the default sort order for items in the list. It is used when the SortType property is not stNone. The Sort method also uses this as a comparison function.
If I1 is greater than I2, CompareItems returns a value greater than 0. If I1 is the same as I2, CompareItems returns 0. If I1 is less than I2, CompareItems returns a value less than 0.
CompareItems always uses an OnCompare event handler if it is assigned. Otherwise, it compares the captions of the items, taking into account the CaseSensitive property. Descendant classes can override CompareItems to provide a different default sort order.