TcxTreeListNode Class
A Tree List node.
Declaration
TcxTreeListNode = class(
TPersistent,
IInterface,
IcxDragSizing,
IdxAutomationElement
)
Remarks
Tree List content is arranged into nodes and columns. Nodes correspond to data rows with values displayed in columns. Each node can include multiple expandable nested nodes.

Main API Members
The list below outlines key members of the TcxTreeListNode class.
Content-Related APIs
- Texts
- Provides indexed access to all column values that correspond to the node (as text strings).
- ValueCount
- Returns the number of column values available using Texts and Values properties
- Values
- Provides indexed access to all column values that correspond to the node.
State Management
- AllowGrayed
- Specifies if an intermediate state is available for the node (in addition to checked and unchecked).
- CanCollapse | CanExpand
- Identify if the node can be expanded or collapsed.
- Checked
- Specifies if the node is checked.
- Collapse | Expand
- Collapse or expand the node (optionally including nested nodes).
- Focused
- Specifies if the node has focus.
- Visible
- Specifies if the node is available as part of Tree List content.
Node Structure Navigation
All methods listed in this section allow you to access adjacent nodes within the parent Tree List control hierarchy.
Tip
All listed structure navigation methods are particularly useful for recursive navigation through the Tree List control hierarchy.
- GetNext | GetPrev
- Provide access to next and previous nodes within a complete node list accessible using the TreeList.AbsoluteItems property.
- GetNextVisible | GetPrevVisible
- Provide access to next and previous nodes within a visible node list accessible using the TreeList.AbsoluteVisibleItems property.
- GetNextChild | GetPrevChild
- Provide access to next and previous child nodes for the target node.
- getNextSibling | getPrevSibling
- Provide access to next and previous nodes at the same hierarchy level.
- GetNextSiblingVisible | GetPrevSiblingVisible
- Provide access to the next and previous visible nodes at the same hierarchy level.
Nested Node Management
- AddChild | AddChildFirst | InsertChild
- Add/insert nested Tree List nodes.
- Count
- Returns the number of nested nodes at the current hierarchy level (nodes available using the Items property).
- Items
- Provides indexed access to all nested nodes at the next hierarchy level.
General-Purpose API Members
- Delete
- Deletes the current node and all nested nodes.
- Parent
- Provides access to the parent node.
- Root
- Provides access to the root node in the parent control hierarchy.
- TreeList
- Provides access to the parent Tree List control.
Code Example: Create and Populate Unbound Tree List Controls
The following code example creates a TcxTreeList control with three columns and populates it with nodes arranged into a tree-like hierarchy (in unbound mode):
uses
cxTL; // Declares the TcxTreeList control and related types
// ...
var
ATreeList: TcxTreeList;
ABand: TcxTreeListBand;
AColumn: TcxTreeListColumn;
ARootNode, ANode, AChildNode: TcxTreeListNode;
begin
ATreeList := TcxTreeList.Create(Self); // Creates a TcxTreeList control
ATreeList.Parent := Self; // Associates the created control with the parent form
ATreeList.BeginUpdate; // Initiates the following batch operation
try
ATreeList.Align := alClient;
// Create a band and three columns
ABand := ATreeList.Bands.Add;
ABand.Caption.Text := 'General Information';
AColumn := ATreeList.CreateColumn(ABand);
AColumn.Caption.Text := 'Name';
AColumn := ATreeList.CreateColumn(ABand);
AColumn.Caption.Text := 'Distance (000km)';
AColumn := ATreeList.CreateColumn(ABand);
AColumn.Caption.Text := 'Period (days)';
// Create all nodes and assign values
ARootNode := ATreeList.Add;
ARootNode.Values[0] := 'Sun';
ANode := ATreeList.AddNode(nil, ARootNode, nil, tlamAddChild);
ANode.Values[0] := 'Mercury';
ANode.Values[1] := 57910;
ANode.Values[2] := 87.97;
ANode := ATreeList.AddNode(nil, ARootNode, nil, tlamAddChild);
ANode.Values[0] := 'Venus';
ANode.Values[1] := 108200;
ANode.Values[2] := 224.7;
ANode := ATreeList.AddNode(nil, ARootNode, nil, tlamAddChild);
ANode.Values[0] := 'Earth';
ANode.Values[1] := 149600;
ANode.Values[2] := 365.26;
AChildNode := ANode.AddChild;
AChildNode.Values[0] := 'Moon';
AChildNode.Values[1] := 384;
AChildNode.Values[2] := 27.32;
ARootNode.Expand(True); // Expands all nodes starting from the root level
finally
ATreeList.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
end;
ATreeList.ApplyBestFit; // Adjusts column width to fit all captions and content in full
end;

Direct TcxTreeListNode Class References
The following public API members reference a TcxTreeListNode object:
Control-Level Node Access Properties
- TcxCustomTreeList.AbsoluteItems
- Provides indexed access to all nodes in the Tree List control (regardless of hierarchy levels and visibility).
- TcxCustomTreeList.AbsoluteVisibleItems
- Provides indexed access to all visible nodes in the Tree List control (regardless of hierarchy levels).
- TcxCustomTreeList.Items
- Provides indexed access to all nodes at the root level.
- TcxCustomTreeList.Root
- Provides access to the virtual node that considered to be the parent of root nodes.
- TcxCustomTreeList.TopNode
- Returns the first node instance.
Control-Level Node Creation Methods
- TcxCustomTreeList.AddNode
- Creates a new node at the target position or moves an existing node to a new position.
- TcxTreeList.Add
- Creates a new node and adds it at the root level.
- TcxTreeList.AddChild
- Creates a node and appends it as a child of the specified node.
- TcxTreeList.AddChildFirst
- Creates a node and adds it before the first child node of the specified node.
- TcxTreeList.AddFirst
- Creates a new node with the default settings and adds it before the first node at the root level.
- TcxTreeList.Insert
- Creates a new node and inserts it after the specified node.
- TcxTreeList.InsertEx
- Inserts a new or existing node after the specified node.
Node-Level Nested Node Creation Methods
- TcxTreeListNode.AddChild
- Creates a node and inserts it as the last item in the next level of the node hierarchy.
- TcxTreeListNode.AddChildFirst
- Creates a node and inserts it as the first item in the next level of the node hierarchy.
- TcxTreeListNode.InsertChild
- Inserts a child node into the node’s child collection.
Node-Level Access Properties
- TcxTreeListNode.getFirstChild
- Returns the node’s first child.
- TcxTreeListNode.GetFirstChildVisible
- Returns a node’s first child that is available in the View.
- TcxTreeListNode.GetLastChild
- Returns the node’s last child.
- TcxTreeListNode.GetLastChildVisible
- Returns a node’s last child that is available in the View.
- TcxTreeListNode.GetNext
- Returns the node next to the current one within the tree structure.
- TcxTreeListNode.GetNextChild
- Returns the next child node after the node specified.
- TcxTreeListNode.getNextSibling
- Returns the next node at the current nesting level.
- TcxTreeListNode.GetNextSiblingVisible
- Returns the next node available in the View at the current nesting level.
- TcxTreeListNode.GetNextVisible
- Returns the next visible node.
- TcxTreeListNode.GetPrev
- Returns the node previous to the current one.
- TcxTreeListNode.GetPrevChild
- Returns the previous child of the node specified.
- TcxTreeListNode.getPrevSibling
- Returns the previous node at the current nesting level.
- TcxTreeListNode.GetPrevSiblingVisible
- Returns the previous node available in the View at the current nesting level.
- TcxTreeListNode.GetPrevVisible
- Returns the previous visible node.
Terminal TcxTreeListNode Class Descendants
TcxDBTreeList and TcxVirtualTreeList components use the following TcxTreeListNode class descendants:
- TcxDBTreeListNode
- A data-aware control’s node.
- TcxVirtualTreeListNode
- The TcxVirtualTreeList control’s node.