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

# TTreeNode.Collapse

Collapses the current tree node, and optionally collapses any descendent nodes.

## Declaration

Source position: comctrls.pp line 3136

`public procedure TTreeNode.Collapse(`
`Recurse: Boolean`
`);`

## Arguments

`Recurse` |  | True to collapses all descendent nodes in the subtree.

## Description

Collapse calls the BeginUpdate and EndUpdate methods in the TreeView control (when assigned) to reduce the number of updates performed while one or more of the tree nodes are displayed in the collapsed state.

Recurse indicates whether child and all descendent nodes are also collapsed in the method. The default value is False, and causes only the current node instance to be displayed in the collapsed state. When set to True, child nodes are visited and recursively collapsed.

After completion of the method, the affected nodes will have their Expanded properties set to False and their States flags are updated accordingly.

Use Expand to reverse the collapse process. Use ExpandParents to expand all ancestor tree nodes for the current node.