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

# TTreeNode.HasAsParent

Returns True if the specified node is a parent for the current node.

## Declaration

Source position: comctrls.pp line 3132

`public function TTreeNode.HasAsParent(`
`AValue: TTreeNode`
`):Boolean;`

## Arguments

`AValue` |  | Parent node to locate in the ancestor nodes for the class instance.

## Function result

True if the specified node is ancestor of the current tree node (also when the ancestor node is not specified).

## Description

HasAsParent is Boolean function which indicates whether the tree node specified in AValue is an ancestor of the current tree node.

The return value is True if AValue is the Parent node for the current class instance. Preceding Parent nodes in the hierarchy are also searched if needed by calling their HasAsParent method, and the return value is set to True if any one of them is the node in AValue.

The return value is set to False when a node is encountered and its Parent node has not been assigned.

Strangely enough, the method also returns True if AValue is unassigned (Nil).

HasAsParent is called from the MoveTo method and used to enable or disable change event handlers in the TreeView control when a node is relocated in the node hierarchy.

## See also

TTreeNode.Parent |  | Parent node for the current tree node.