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

# TTreeNode

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

TTreeNode is a single item that holds data in TTreeView

## Declaration

Source position: comctrls.pp line 1884

`type TTreeNode = class(TPersistent)`
`public`
`constructor Create();` |  | calls inherited then itntialises indexes and sets subtree count to 1
`function AlphaSort;` |  | AlphaSort - if True, sorted alphabetically
`procedure Assign(); override;` |  | Assign - if Source is of correct type, copies details directly, otherwise calls inherited Assign which probably raises an exception
`procedure Collapse();` |  | Collapse - method for collapsing tree view to show only the main stems. Apply recursively if Recurse is True
`function CustomSort();` |  | CustomSort - if True, the customised sort method specified in SortProc is to be used
`function DefaultTreeViewSort();` |  | DefaultTreeViewSort - returns result of string comparison between names of Node1 and Node2
`procedure Delete;` |  | Delete the curent TreeNode
`procedure DeleteChildren;` |  | DeleteChildren - remove the descendent Nodes in the tree structure
`destructor Destroy; override;` |  | - destructor for : unbinds all references, frees data and calls inherited Destroy
`function DisplayExpandSignLeft;` |  | DisplayExpandSignLeft - returns the position of the left edge of the expand sign
`function DisplayExpandSignRect;` |  | DisplayExpandSignRect - returns the coordinates of the rectangle within which the expand sign are displayed
`function DisplayExpandSignRight;` |  | DisplayExpandSignRight - returns the position of the right edge of the expand sign (ie takes into account the width of the icon etc)
`function DisplayIconLeft;` |  | DisplayIconLeft - returns the position of the actual icon for the expand sign (usually 1 pixel greater than DisplayExpandSignLeft)
`function DisplayRect();` |  | DisplayRect - returns the coordinates of the rectangle containing the current entry; if TextOnly is True, returns the coordinates for the text
`function DisplayStateIconLeft;` |  | DisplayStateIconLeft - returns the position of the State Icon
`function DisplayTextLeft;` |  | DisplayTextLeft - returns the position of the left edge of the text
`function DisplayTextRight;` |  | DisplayTextRight - returns the position of the right edge of the text
`function EditText;` |  | EditText (currently set False - to be implemented)
`procedure EndEdit();` |  | EndEdit (to be implemented)
`procedure Expand();` |  | Expand - method for expanding the current node. If Recurse is True, also expand all descendent nodes
`procedure ExpandParents;` |  | ExpandParents - apply expansion to the parents of the current node
`function Bottom;` |  | Bottom - returns the position of the displayed tree structure (whether or not it is expanded)
`function BottomExpanded;` |  | BottomExpanded - returns the position of the bottom of the fully expanded tree structure
`function GetParentNodeOfAbsoluteLevel();` |  | GetParentNodeOfAbsoluteLevel - returns the parent of all nodes at this absolute level
`function GetFirstChild;` |  | GetFirstChild - returns the first child node of this parent
`function GetHandle;` |  | GetHandle - returns the operating system Handle for the current node
`function GetLastSibling;` |  | GetLastSibling - returns the last node at the same level as the current node
`function GetLastChild;` |  | GetLastChild - returns the last child node of this parent
`function GetLastSubChild;` |  | GetLastSubChild - returns the last sub-child node of this parent
`function GetNext;` |  | GetNext - returns the next node in the list
`function GetNextChild();` |  | GetNextChild - returns the next child node of the parent specified by AValue
`function GetNextExpanded;` |  | GetNextExpanded - returns the next expanded node
`function GetNextMultiSelected;` |  | GetNextMultiSelected - returns the next node in a multiselection
`function GetNextSibling;` |  | GetNextSibling - returns the next node in the same level as the current node
`function GetNextVisible;` |  | GetNextVisible - returns the next visible (ie not hidden) node
`function GetPrev;` |  | GetPrev - returns the previous node in the list
`function GetPrevChild();` |  | GetPrevChild - returns the previous child node of the parent specified by AValue
`function GetPrevExpanded;` |  | GetPrevExpanded - returns the previous expanded node
`function GetPrevMultiSelected;` |  | GetPrevMultiSelected - returns the previous node in a multi-selection
`function GetPrevSibling;` |  | GetPrevSibling - returns the previous node in the same level as the current node
`function GetPrevVisible;` |  | GetPrevVisible - returns the previous visible (not hidden) node
`function HasAsParent();` |  | HasAsParent - returns True if the node specified by AValue has a parent
`function IndexOf();` |  | IndexOf - returns the index of the node specified by AValue
`function IndexOfText();` |  | IndexOfText - returns the index of the node containing the specified Text string
`function FindNode();` |  | FindNode - returns the node containing the specified text string
`function GetTextPath;` |  | GetTextPath - returns a string containing the path to the current node
`procedure MakeVisible;` |  | MakeVisible - method for rendering a node visible
`procedure MoveTo(); virtual;` |  | MoveTo - method for relocating a node to the specified Destination using the specified mode of attachment
`procedure MultiSelectGroup;` |  | MultiSelectGroup - method for multi-selecting a group of nodes
`procedure Update;` |  | Update the contents and appearance of the curent node
`procedure ConsistencyCheck;` |  | ConsistencyCheck - makes sure all references to and from the node are consistent
`procedure WriteDebugReport();` |  | WriteDebugReport - for debugging. If Recurse is True, report for all descendants as well
`property AbsoluteIndex: Integer; [r]` |  | AbsoluteIndex - the absolute index of the current node, ie without taking into account the level of ancestry
`property Count: Integer; [r]` |  | Count - the number of nodes
`property Cut: Boolean; [rw]` |  | Cut - whether the node has been Cut
`property Data: Pointer; [rw]` |  | Data - pointer to th eNode's data
`property Deleting: Boolean; [r]` |  | Deleting - if True, the node is being deleted
`property Focused: Boolean; [rw]` |  | Focused - if True, the node has received focus
`property DropTarget: Boolean; [rw]` |  | DropTarget - if True, the current node is a target for a drop process
`property Expanded: Boolean; [rw]` |  | Expanded - if True, the node has been expanded
`property Handle: THandle; [r]` |  | Handle - the operating system handle for this node
`property HasChildren: Boolean; [rw]` |  | HasChildren - if true, this node has descendent nodes
`property Height: Integer; [rw]` |  | The Height of the current node
`property ImageIndex: Integer; [rw]` |  | ImageIndex - the index of the image associated with the current node. Default -1 if no image
`property Index: Integer; [rw]` |  | The Index value of the current node
`property IsVisible: Boolean; [r]` |  | IsVisible - if True, the current node is visible (not hidden)
`property IsFullHeightVisible: Boolean; [r]` |  | IsFullHeightVisible - if True, the full height of the TreeNode is visible within the display window
`property Items: TTreeNode; default; [rw]` |  | Items - the index of the current node within the list of items
`property Level: Integer; [r]` |  | The Level of descendance of indentation of the current node
`property MultiSelected: Boolean; [rw]` |  | MultiSelected - if True, several nodes have been selected simultaneously (eg using the Shift or Ctrl key while selecting)
`property OverlayIndex: Integer; [rw]` |  | OverlayIndex - the index of the overlay
`property Owner: TTreeNodes; [r]` |  | The Owner control of the current TreeNode
`property Parent: TTreeNode; [r]` |  | The Parent of the current node
`property Selected: Boolean; [rw]` |  | Selected - if True, the current node has been selected
`property SelectedIndex: Integer; [rw]` |  | SelectedIndex - the index of the current node if selected: default - if not selected
`property SubTreeCount: Integer; [r]` |  | SubTreeCount - the number of sub-trees
`property StateIndex: Integer; [rw]` |  | StateIndex the index of the state (within an enumerated type)
`property Text: String; [rw]` |  | The Text string of the current node
`property TreeNodes: TTreeNodes; [r]` |  | the collection of TreeNodes to which this node belongs
`property TreeView: TCustomTreeView; [r]` |  | The TreeView to which this node belongs
`property Top: Integer; [r]` |  | The position of the Top of the current node
`end;`

## Inheritance

`TTreeNode` |  | TTreeNode is a single item that holds data in TTreeView
`TPersistent`
`TObject`

## Description

A TTreeNode is part of a TTreeView and is used for storing data. This can be done by using the Caption property or for more complex data the Data property can be used. Each node can have sibling or child items associated with it.

## See also

#lcl.stdctrls.HowToUseStdCtrls |  | How to use StdCtrls, ComCtrls or ExtCtrls

The latest version of this document can be found at lazarus-ccr.sourceforge.net.