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

# TCustomTreeView.CustomSort

If True, the external method specified in SortProc is used for sorting.

## Declaration

Source position: comctrls.pp line 3712

`public function TCustomTreeView.CustomSort(`
`SortProc: TTreeNodeCompare`
`):Boolean;`

## Arguments

`SortProc` |  | Routine used to implement the sort procedure in the method.

## Function result

Always returns False.

## Description

CustomSort is a Boolean function used to sort the tree nodes in Items using the sort procedure specified in SortProc. If SortProc is not assigned, the DefaultTreeViewSort method is used in the sort procedure.

No actions are performed in the method when the number of tree nodes in Items is 0 (zero).

The return value is always False.

CustomSort calls BeginUpdate to minimize updates during the sorting process. EndUpdates is called when the sorting process is completed.

Top-level nodes in Items are sorted by calling the SortTopLevelNodes in items. Child nodes are then sorted (when present), starting at the first top-level node in the tree. The ClearCache method in Items is called to invalidate the node cache for the control.

The States property is updated to force the node coordinates and scroll bars to be refreshed in the control.