Sign in Join
FPDoc Onlineexperiment

TCustomListView.CustomSort function

Member of TCustomListViewpublicIn unit ComCtrls

Sorts the Items for the list view control using the specified procedure or the OnCompare event handler.

Declaration

pascal
function CustomSort(ASortProc: TLVCompare; AOptionalParam: PtrInt)
: Boolean

Arguments

ASortProc

Sort routine used to compare values in the list items to determine their order.

AOptionalParam

An optional Pointer to an Integer value used the sort routine.

Function result

True when either the sort routine or the OnCompare event handler has been assigned.

Description

CustomSort is a Boolean function used to sort the list items on the control using a custom sort routine to order the items.

Use the ASortProc argument to specify the comparison routine needed for the custom sort. When omitted, the OnCompare event handler is used to determine the order for the list items.

Use AOptionalParam to specify a pointer to an optional Integer value passed as a parameter to the sort procedure.

No actions are performed when Items contains fewer than two list items, or when lffPreparingSorting has already been included in the flags for the control.

CustomSort saves and restores Focused or Selected items on exit. Checked items are also restored when OwnerData (or virtual mode) is not enabled.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.