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

TListControlItems.CompareItems

Implements a comparison function for items in the collection.

Declaration

Source position: comboex.pas line 103

protected function TListControlItems.CompareItems(

  AItem1: TListControlItem;

  AItem2: TListControlItem

):Integer; virtual;

Arguments

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

TListControlItems.CaseSensitive

  

Indicates if case sensitivity is used when comparing items in the collection.

TListControlItems.Sort

  

Performs the Sort routine required for the setting in SortType.

TListControlItems.SortType

  

Determines the comparison mechanism used for collection items in the Sort method.

CompareStr


Version 4.0 Generated 2025-05-03 Home