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

# TTreeNodes.FindNodeWithText

Finds a tree node containing the specified text.

## Declaration

Source position: comctrls.pp line 3264

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

## Arguments

`NodeText` |  | Text value to locate in the list of tree nodes.

## Function result

Tree node with the text value specified in NodeText, or Nil when a matching node is not found.

## Description

FindNodeWithText is a TTreeNode function used to get the node in the list of tree nodes where the Text for the node matches the specified value.

NodeText is the text to locate in the TTreeNode instances.

FindNodeWithText starts the node search beginning with the top-level tree nodes. It visits the TTreeNode instances in the node list until a node with Text that matches the value in the NodeText argument is found.

FindNodeWithText uses the find options assigned to the tree view control to control the actions performed in the search. If the node options include foFindIgnoresCase, a case-insensitive comparison is used to compare the text in each node text to the value in the NodeText argument.

The return value is the TTreeNode instance with text that matches the specified value. It is set to Nil if a node is not found with the specified text value.

Use FindNodeWithTextPath to get a node with a given text path.

## See also

TTreeNodes.GetFirstNode |  | Gets the first tree node in the container.
TTreeNodes.FindNodeWithTextPath |  | Finds a node with the hierarchical path specified in TextPath.
TTreeNode.GetNext |  | Gets the next node in the tree hierarchy.
SysUtils.SameText