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

TCustomListView.CustomSort

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

Declaration

Source position: comctrls.pp line 1619

public function TCustomListView.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.


Version 3.2 Generated 2024-02-25 Home