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

# TTreeNodes.Clear

Removes tree nodes in the container and its internal cache.

## Declaration

Source position: comctrls.pp line 3286

`public procedure TTreeNodes.Clear; virtual;`

## Description

Clear is a method used to remove all of the existing TTreeNode instances found in the container. In addition, the internal TNodeCache for the container is cleared.

Clear visits the tree nodes in the container and calls its Delete method to physically remove the node. This process is repeated until there a TTreeNode instance is not available from the GetLastNode method. The internal selection list for the container is cleared, as are child accessibility objects in the Owner (TCustomTreeView).

Clear encloses these operations with BeginUpdate and EndUpdate to prevent updates to the container while the method is active.

## See also

TTreeNodes.BeginUpdate |  | Starts an update process for the tree nodes in the container.
TTreeNodes.EndUpdate |  | Finishes an update process for the tree nodes in the container.
TTreeNodes.GetLastNode |  | Gets the last top-level tree node in the container.
TTreeNode.Delete |  | Frees the current tree node when the Deleting property is not True.
TNodeCache |  | TNodeCache - a cache (temporary storage record) for a TTreeNode and its index.