Skip to main content

Overview

TeeTree provides multiple ways to add nodes to your tree structure. You can add root nodes, child nodes, and sibling (brother) nodes using simple method calls.

Adding Root Nodes

The simplest way to add a node is using the Add method without a parent:
You can also use the AddRoot method explicitly:

Adding Child Nodes

There are several ways to add child nodes to an existing parent:

Method 1: Using AddChild

Method 2: Using Add with Parent Parameter

Method 3: Using Shapes.AddChild

Adding Sibling Nodes

To add a node at the same level as an existing node:

Chaining Node Creation

You can create multiple levels of nodes in a single statement:

Adding Nodes at Specific Positions

You can specify X and Y coordinates when adding nodes:

Complete Example

Here’s a complete example showing various ways to add nodes:

Interactive Example: Add Buttons

Create an interactive form that allows users to add nodes dynamically:

Key Points

  • Use Add or AddRoot for root nodes without parents
  • Use AddChild to add child nodes to a parent
  • Use AddBrother to add sibling nodes at the same level
  • Chain method calls to create multiple levels efficiently
  • Set Expanded := True to show newly added children
  • Preserve node references when you need to manipulate them later

Removing Nodes

To remove nodes from the tree: