Show: Delphi C++
Display Preferences

Vcl.ComCtrls.TCustomListView.CustomSort

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function CustomSort(SortProc: TLVCompare; lParam: LPARAM): Boolean;

C++

bool __fastcall CustomSort(PFNLVCOMPARE SortProc, NativeInt lParam);

Properties

Type Visibility Source Unit Parent
function public
Vcl.ComCtrls.pas
Vcl.ComCtrls.hpp
Vcl.ComCtrls TCustomListView

Description

Sorts the items in the list using the specified ordering function.

Call CustomSort to sort the items in the list using the ordering function defined by the SortProc parameter:

 TLVCompare = function(lParam1, lParam2, lParamSort: Integer): Integer stdcall;

The SortProc parameter specifies an ordering function that compares the list items passed as lParam1 and lParam2. The ordering function returns an integer that indicates whether lParam1 is the same as lParam2 (return value is 0), lParam1 is greater than lParam2 (return value is greater than 0), or lParam1 is less than lParam2 (return value is less than 0). The lParam parameter of CustomSort is an optional value that is passed as the third parameter to the ordering function.

If the SortProc parameter is nil (Delphi) or NULL (C++), CustomSort compares the list items by generating an OnCompare event. This allows the OnCompare event handler to provide different ordering criteria (such as ascending vs. descending order), based on the value of the lParam parameter.

If the ordering function is not provided and there is no OnCompare event handler, CustomSort sorts items alphabetically by their Caption values.

CustomSort returns true if the list is successfully sorted.

Warning: CustomSort does not work if the application is running in virtual mode.

See Also

Code Examples


Personal tools
In Other Languages
Previous Versions
Assistance