Skip to main content

TcxTreeListNode Class

The base class for nodes used in the TcxDBTreeList, TcxTreeList, and TcxVirtualTreeList controls.

Declaration

TcxTreeListNode = class(
    TPersistent,
    IInterface,
    IcxDragSizing
)

Remarks

Nodes are organized in a hierarchical structure using parent-child relationships. Every node can have child nodes and these are defined by the Items collection.

Nodes can be expanded to display the next level of child nodes. Users can expand a node by pressing its plus (+) button if it is displayed or can expand it by setting the Expanded property to True. Setting the property to False hides child nodes. The TreeList control fires the following events in response to expanding/collapsing its nodes: OnExpanding, OnExpanded, OnCollapsing, and OnCollapsed.

The HasChildren property specifies whether a node may have children. The number of child nodes is returned via the Count property. You can manually set the property to True to display the plus (+) button for the node (ensure that the TreeList control’s OptionsView.Buttons property is set to True). An end-user can press it and thus generate the TreeList control’s OnExpanding event. This can be used to implement dynamic node loading.

The TreeList control allows you to display up to two images within nodes. You need to assign ImageList instances to the TreeList control’s Images and StateImages properties for this purpose. There are a number of ways to assign images to individual nodes.

The TcxTreeListNode class provides several methods that can be used to navigate through the TreeList control. These methods provide access to the next/previous visible, child and sibling nodes. See the GetNext, GetNextChild, getNextSibling, GetNextSiblingVisible, GetNextVisible, GetPrev, GetPrevChild, getPrevSibling, GetPrevSiblingVisible, and GetPrevVisible method descriptions. Note that using these methods improves performance during recursive navigation through the tree structure.

The TreeList control provides drag-and-drop functionality, which enables users to move nodes to another position, to another TreeList control or even to a third-party control. If the TreeList control’s DragMode property is set to dmAutomatic, dragging occurs automatically. You can control drag-and-drop operations by handling the OnDragOver and OnDragDrop events.

Do not use this class directly. Use its descendants instead.

Inheritance

TObject
TPersistent
TcxTreeListNode
See Also