Understanding Tree Structure
A TeeTree component maintains a network-hierarchy of nodes, where:- Root nodes have no parent
- Child nodes belong to a parent node
- Brother nodes share the same parent
- Each node is a full component with properties, methods, and events
Adding Root Nodes
Root nodes are the top-level nodes in your tree without any parent.The
Add method without a parent parameter automatically creates a root node.Adding Child Nodes
Child nodes are attached to a parent node and form the tree hierarchy.1
Using Parent Node
The most direct way is to call
AddChild on the parent node:2
Using Tree Component
Pass the parent as the second parameter:
3
Using Shapes Collection
Use the Shapes collection’s AddChild method:
Child Node Variations
Adding Brother Nodes
Brother nodes (siblings) share the same parent as an existing node.10 Methods to Add Nodes
Here’s a comprehensive example from the TeeTree demo showing different addition techniques:Expanding Nodes
After creating child nodes, expand the parent to make them visible:Interactive Node Addition
Example of adding nodes interactively based on user selection:Inserting Nodes at Specific Positions
Best Practices
Performance Tips
Performance Tips
When adding many nodes, set capacity for better performance:
Memory Management
Memory Management
- Nodes are automatically freed when their parent is destroyed
- Root nodes are freed when the Tree component is destroyed
- Use
Clearto remove all nodes:Tree1.Shapes.Clear
Organization
Organization
- Group related nodes under common parents
- Use meaningful text for node identification
- Consider using
DataorTagObjectproperties to associate custom data
Common Patterns
Building from Data
Building Hierarchical Structure
Next Steps
- Learn about Working with Nodes to manipulate existing nodes
- Explore Node Formatting to customize appearance
- See Connections to link nodes together
