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

# TTreeNode.GetNextExpanded

Returns the next expanded tree node in the node hierarchy.

## Declaration

Source position: comctrls.pp line 3117

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

## Arguments

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

## Function result

Tree node which is the next expanded child or sibling for the node, or Nil when a visible and expanded node is not not found.

## Description

GetNextExpanded calls GetFirstVisibleChild to start the search for the next expanded tree node. The AEnabledOnly argument indicates whether the next node must also be in the Enabled state. When set to False, the Enabled state is not examined in the method.

If the node is assigned and its Expanded property is set to True, and matches the AEnabledOnly argument, it is used as the return value for the method. Otherwise, the GetNextVisibleSibling method is called to get a sibling node with the required states.

If a tree node is not found, the Parent node is searched for a visible sibling node. The return value is Nil if a tree node with the required states is not found.

## Version info

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