Overview
TTreeNodeShape is the main class representing individual nodes in a TeeTree. Each node is a full component with its own properties, methods, and events. Nodes can have parent-child relationships, visual formatting, text, images, and connections to other nodes.
Class Hierarchy
Key Features
- Parent-child hierarchy support
- Multiple visual styles (rectangle, circle, diamond, etc.)
- Text with multi-line support and alignment
- Image support
- Gradient fills and shadows
- Border and brush customization
- Automatic sizing and positioning
- Connection management
- Expand/collapse functionality
Properties
Position and Size
Left coordinate of the node.
Top coordinate of the node.
Right coordinate of the node.
Bottom coordinate of the node.
Alias for X0. Left coordinate of the node.
Alias for Y0. Top coordinate of the node.
Width of the node in pixels.
Height of the node in pixels.
When True, node size is determined by text size.
Determines which coordinates are automatically calculated. Has
Left and Top boolean properties.Visual Appearance
Visual style of the node:
tssRectangle- Rectangle shapetssCircle- Circle/ellipsetssRoundRectangle- Rounded rectangletssDiamond- Diamond shapetssTriangleTop- Triangle pointing uptssTriangleBottom- Triangle pointing downtssTriangleLeft- Triangle pointing lefttssTriangleRight- Triangle pointing righttssVertLine- Vertical linetssHorizLine- Horizontal linetssLine- Diagonal linetssInvertLine- Inverted diagonal linetssChamfer- Chamfered rectangletssCustom- Custom shape
Background color of the node.
Alternative background color.
Pen used to draw the node border.
Brush used to fill the node interior.
When True, node interior is not filled.
Transparency level from 0 to 100%.
Radius for rounded corners when Style is tssRoundRectangle or tssChamfer.
Gradient and Shadow
Gradient fill settings.
When False, draws gradient in shape rectangle bounds instead of clipping to shape.
Shadow settings for the node.
Text
Multi-line text displayed in the node. Supports:
Angle- Text rotation (0-360 degrees)HorizAlign- Horizontal alignment (Center, Left, Right)VertAlign- Vertical alignment (Center, Top, Bottom)HorizOffset- Horizontal pixel offsetVertOffset- Vertical pixel offsetClipText- Clips text outside node boundsTransparency- Text transparencyVisible- Show or hide text
Simple string property to get/set the first line of text.
Font used for text display.
Horizontal text alignment:
htaCenter, htaLeft, or htaRight.Vertical text alignment.
Images
Custom picture to display with the node.
Index of default stock image:
tiNone- No imagetiFolderClose- Closed foldertiFolderOpen- Open foldertiFolderOpenClose- Auto open/close foldertiDesktop,tiMyPC,tiNetworkNei, etc.tiChecked,tiUnChecked- CheckboxestiRadioChecked,tiRadioUnChecked- Radio buttons
Index in the Tree’s ImageList.
Position of image:
iaAutomatic- Auto-positionediaLeftTop,iaRightBottom,iaLeftBottom,iaRightTopiaLeft,iaTop,iaRight,iaBottomiaCenter- Centered
Width of image. 0 = automatic.
Height of image. 0 = automatic.
Read-only rectangle returning image position.
Hierarchy
Parent node. When assigned, this node becomes a child.
List of child nodes.
Obsolete. Use Children instead.
List of additional parent nodes (for multi-parent scenarios).
Read-only. Returns the root node of this hierarchy.
Index among sibling nodes. -1 when node has no parent.
Read-only. Returns the previous sibling node.
Expand/Collapse
When True, child nodes are visible.
Cross-box display style:
scAuto- Displayed only when node has childrenscAlways- Always displayedscNever- Never displayed
Connections
List of connections from this node to other nodes.
State
When True, node is visible (parent must also be expanded).
When True, node is selected.
When True, checkbox/radio image is checked.
Other
Mouse cursor when hovering over node.
User-defined data pointer.
User-defined object reference.
Reference to the parent Tree component.
Read-only. Total bounds including image.
Methods
Adding Children
Adds a new child node.Parameters:
AText- Text for the new child
Alias for AddChild.
Adds a child at the first position.
Adds a sibling node.
Adds a child with associated data.
Inserts a child at specific index.
Connections
Creates a connection to another node.Returns: The newly created connection
Creates a connection with associated data.
Expand/Collapse
Toggles expand/collapse state.
Collapses node and optionally all descendants.
Toggles checkbox state.
Visibility
Makes node visible.
Hides node.
Drawing
Draws the node.
Draws resize handles when selected.
Repaints the node.
Geometry
Returns the node’s bounding rectangle.
Returns X coordinate of center.
Returns Y coordinate of center.
Tests if coordinates are inside node.Returns: True if point is inside node
Tests if coordinates are inside node’s image.
Tests if coordinates are inside cross-box.
Movement and Resizing
Moves node by offset.
Resizes node from a corner.
Recalculates node size based on text.
Hierarchy Operations
Returns the depth level in hierarchy (0 for root).
Returns the number of child nodes.
Returns True if node has children.
Selects all child nodes.
Sorts children alphabetically.
Z-Order
Moves node to front of drawing order.
Moves node to back of drawing order.
Other
Removes all child nodes.
Copies properties from another node.
Copies only visual format from another node.
Saves node and children to text file.
Events
Fired when node is clicked.
Fired when node is double-clicked.
Fired when mouse enters node.
Fired when mouse leaves node.
Fired when mouse moves over node.
Usage Examples
Creating a Node Hierarchy
Customizing Node Appearance
Adding Images
Working with Connections
Handling Node Events
Dynamic Node Creation
See Also
- TTree - Main tree component
- TTreeConnection - Connection between nodes
- TDBTree - Database-aware tree
