RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TListControlItems.CustomSort Method

Sorts the items in the collection using a specified comparison function.

Pascal
procedure CustomSort(Compare: TListItemsCompare);
C++
__fastcall CustomSort(TListItemsCompare Compare);

Call Sort to sort the items in the collection based on the comparison function that is the value of the Compare parameter.  

Compare is a function that compares two items in the list. Its List parameter is this TListControlItems object. The Index1 and Index2 parameters are the indexes of the items to compare in the Items property array. This comparison function should return a value less than 0 if the first item is less than the second, a value greater than 0 if it is greater than the second, and 0 if the two items are equivalent.

Note: CustomSort sorts the items in the list, but does not maintain the sort order when new items are added. To provide a custom sort order that persists when new items are added, set the SortType property to stData and supply an OnCompare event handler.
 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!