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

# TTreeNode.GetFirstVisibleChild

Gets the tree node that is the first visible child node in the subtree.

## Declaration

Source position: comctrls.pp line 3108

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

## Arguments

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

## Function result

First matching visible child node for the current node, or Nil when there are no child nodes.

## Description

GetFirstVisibleChild is a TTreeNode function used to get the tree node that is the first visible child node in the subtree. The AEnabledOnly argument indicates whether the selected node must also be Enabled. If AEnabledOnly is False, the Enabled property is not examined.

GetFirstVisibleChild calls GetFirstChild to retrieve the first child node in Items. If the first child node is not visible, each of the TTreeNode instances in Items is examined after calling GetNextVisibleSibling.

The return value is the first TTreeNode instance with its Visible property set to True. The return value is Nil if no visible child node was found in Items.

Use GetLastVisibleChild to retrieve the last visible child node in Items.

## 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.GetFirstChild |  | Gets the first child node in the Items property.
TTreeNode.GetNextVisibleSibling |  | Gets the next visible node at the same level in the node tree.
TTreeNode.GetLastVisibleChild |  | Gets the last child node in the subtree with its Visible property set to True.
TNodeState |  | Enumerated type denoting the state for a TreeNode.
TNodeStates |  | Set type used to store TNodeState value(s).