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

# TCustomTreeView.OnCollapsing

Event handler signalled prior to collapsing a node on the tree view control.

## Declaration

Source position: comctrls.pp line 3672

`protected property TCustomTreeView.OnCollapsing : TTVCollapsingEvent read FOnCollapsing write FOnCollapsing;`

## Description

OnCollapsing is a TTVCollapsingEvent property with the event handler signalled prior to collapsing a node on the tree view control.

The Sender argument is the tree view control for the event notification.

Node contains the TTreeNode instance to be collapsed.

AllowCollapse is a variable argument which indicates if the tree node can (or should) be collapsed on the tree view control.

OnCollapsing is signalled from the CanCollapse method (when assigned), and occurs when the Expanded property in a tree node is changing from True to False. The value returned in AllowCollapse is used as the return value for the CanCollapse method. Setting AllowCollapse to False in the handler routine prevents the tree node from being collapsed.

Use OnCollapsed to perform actions needed after a tree node has been collapsed on the control.

## See also

TCustomTreeView.CanCollapse |  | Returns True if a given TreeNode can be collapsed.
TCustomTreeView.OnCollapsed |  | Event handler signalled when a tree node has been collapsed on the control.
TTVCollapsingEvent |  | TTVCollapsingEvent - generic event handling method for collapsing a Tree Node if AllowCollapse is True.
TTreeNode.Expanded |  | True if the node has been expanded, False when collapsed.