TListControlItems.CompareItems function
Implements a comparison function for items in the collection.
Declaration
function CompareItems(AItem1: TListControlItem;
AItem2: TListControlItem): Integer; virtualArguments
AItem1 | First list item for the comparison. |
AItem2 | Second list item for the comparison. |
Function result
Relative sort order for the compared items
Description
CompareItems is an
Integer function used to perform a
comparison for items in the collection.
AItem1 and
AItem2 contains the list items compared in the method.
CompareItems uses the value in CaseSensitive to determine if the
comparison of captions value uses case sensitivity. When CaseSensitive is
True, caption values are converted to lowercase prior to performing
the comparison.
CompareItems calls CompareStr to perform a comparison for the
Captions assigned for the specified list items. The return value contains the
relative sort order for the items calculated as a difference between the
ASCII values for characters in the item captions. For example:
- < 0
- The caption in AItem1 comes before the caption in AItem2
- 0
- The captions in AItem1 and Aitem2 are the same
- > 0
- The caption in AItem1 comes after the caption in AItem2
CompareItems is used in the implementation of the Sort method when
SortType contains the value stText or stBoth.
Use the OnCompare event handler when SortType contains
stData or stBoth.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
