Vcl.ListActns.TListControlItems.CustomSort

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure CustomSort(Compare: TListItemsCompare);

C++

void __fastcall CustomSort(TListItemsCompare Compare);

Properties

Type Visibility Source Unit Parent
procedure
function
public
Vcl.ListActns.pas
Vcl.ListActns.hpp
Vcl.ListActns TListControlItems

Description

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

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.

See Also