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

# TCustomTreeView.OnExpanding

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

## Declaration

Source position: comctrls.pp line 3684

`protected property TCustomTreeView.OnExpanding : TTVExpandingEvent read FOnExpanding write FOnExpanding;`

## Description

OnExpanding is a TTVExpandingEvent property with the event handler signalled before a tree node is expanded on the tree view control. It is signalled (when assigned) from the CanExpand method, and allows the application to perform actions needed before the tree node is expanded to reveal its child nodes.

Arguments for the event handler include:

Sender
  Object instance (TCustomTreeView) for the event.
Node
  The TTreeNode instance to be expanded on the tree view control.
AllowExpansion
  Boolean variable argument which indicates whether the tree node can be expanded on the control. Set AllowExpansion to False to prevent expansion of the tree node.

OnExpanding is not signalled if the tree node does not have any child nodes (HasChildren is False).

Use OnExpanded to perform actions needed after a tree node has been expanded on the control.

Use OnCollapsing and OnCollapsed to perform actions before or after a node is collapsed on the tree view control.

## See also

TCustomTreeView.CanExpand |  | True if the specified tree node can be expanded.
TCustomTreeView.NodeHasChildren |  | Determines if the specified tree node has child nodes.
TCustomTreeView.OnExpanded |  | Event handler signalled when a node on the tree view control has been expanded.
TCustomTreeView.OnCollapsing |  | Event handler signalled prior to collapsing a node on the tree view control.
TCustomTreeView.OnCollapsed |  | Event handler signalled when a tree node has been collapsed on the control.
TTVExpandingEvent |  | TTVExpandingEvent - generic event handling method for expanding a tree node if AllowExpansion is True.
TTreeNode.Expanded |  | True if the node has been expanded, False when collapsed.
TTreeNode.Visible |  | True if the tree node is visible in the associated TreeView control.
TTreeNode.HasChildren |  | Indicates whether the tree node has child nodes.