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

# TTreeNode.FindNode

Gets the child tree node in Items with the specified text.

## Declaration

Source position: comctrls.pp line 3106

`public function TTreeNode.FindNode(`
`const NodeText: string`
`):TTreeNode;`

## Arguments

`NodeText` |  | Text for the node to retrieve from Items.

## Function result

The TTreeNode instance in Items with the specified value, or Nil if not found.

## Description

FindNode is a TTreeNode function used to get the child node with the text specified in NodeText.

FindNode examines the child nodes in the Items property. The GetFirstChild method is called to get the first child node in Items. Each tree node in Items is examined after calling GetNextSibling until a node with the requested value is located.

The return value is the TTreeNode instance with a Text property that matches the value in NodeText, or Nil if a tree node is not found.

When the CaseInsensitiveFilenames compiler define is enabled, the SameText routine in SysUtils is called to perform a case-insensitive comparison using the text in the nodes and the value in NodeText. Otherwise, case is significant in the comparisons.

Use methods in the TTreeNodes container to locate tree nodes not in the current subtree; i. e. FindNodeWithText or FindNodeWithTextPath.

## See also

TTreeNode.Text |  | Text displayed for the tree node.
TTreeNode.GetFirstChild |  | Gets the first child node in the Items property.
TTreeNode.GetNextSibling |  | Returns the next node in the tree hierarchy at the same level as the current node.
TTreeNodes.FindNodeWithText |  | Finds a tree node containing the specified text.
TTreeNodes.FindNodeWithTextPath |  | Finds a node with the hierarchical path specified in TextPath.