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

# TCustomListView.AlphaSort

Sorts the first column for the list view control in ascending alphabetic order.

## Declaration

Source position: comctrls.pp line 1628

`public function TCustomListView.AlphaSort: Boolean;`

## Function result

True if the sort criteria is successfully applied to the control.

## Description

AlphaSort is Boolean function used to apply an ascending alphabetic sort order to the list items in the control. The sort order is always applied to Column 0 (the list item and not its sub-items).

AlphaSort updates values in the SortDirection, SortType, and SortColumn properties. Flag values for the control are updated to include lffPreparingSorting prior to setting the property values; this suppresses reordering until the changes are completed.

SortDirection is toggled to s a new sort order to be applied. The final value is sdAscending.

SortType is set to stText to use the TListItem.Caption values to determine the order for the list items. In the default comparison routine. case is significant. Use OnCompare to implement an alternate comparison routine.

SortColumn is set to 0 to use the TListItem.Caption values to determine the order for the list items.

lffPreparingSorting is removed from the flag values to apply the sort criteria to the list items in the control.

The return value is set to True if the sort criteria is successfully applied to the list view control.