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

# TTreeNode.GetLastVisibleChild

Gets the last child node in the subtree with its Visible property set to True.

## Declaration

Source position: comctrls.pp line 3113

`public function TTreeNode.GetLastVisibleChild(`
`aEnabledOnly: Boolean = False`
`):TTreeNode;`

## Arguments

`aEnabledOnly` |  | True if the visible child node must also be Enabled. False if Enabled is not examined.

## Function result

Last visible node in Items, or Nil when child nodes are not found or visible.

## Description

GetLastVisibleChild is a TTreeNode method used to get the last child or descendent node for the current node with its Visible property set to True. The AEnabledOnly indicates whether the last child must also have its Enabled property set to True. When AEnabledOnly is False, the Enabled state for the node is not examined in the method.

GetLastVisibleChild performs a recursive search which starts at the last child node in Items, and continues to each of the last child nodes in the subtree. GetLastChild is called to retrieve the first tree node examined in the method. The search is continued by calling GetLastSubChild until a tree node with the required states (Visible and optionally Enabled) is located.

The return value is Nil if the recursive search for a last child node does not find a tree node with the required states, or the current node does not have child nodes.

## Version info

Modified in LCL version 3.0. Refactored to include the AEnabledOnly argument.

## See also

TTreeNode.Items |  | Provides indexed access to the child nodes for the current node.
TTreeNode.Visible |  | True if the tree node is visible in the associated TreeView control.
TTreeNode.Enabled |  | Controls whether the tree node can be selected, and its visual appearance.
TTreeNode.GetLastChild |  | Gets the last tree node that is a top-level child node in Items.
TTreeNode.GetLastSubChild |  | Returns the last child node or its last descendent node.
TNodeState |  | Enumerated type denoting the state for a TreeNode.
TNodeStates |  | Set type used to store TNodeState value(s).