Skip to main content
The TTree component is the central visual control in TeeTree. It maintains a network-hierarchy of nodes, similar to Microsoft’s TreeView control, but with significantly more power and flexibility.

Overview

TTree is a visual component that manages a collection of nodes and their relationships. Unlike traditional tree controls, every node in TeeTree is a full standalone component with its own properties, methods, and events.

Key Features

Node Management

Maintains a network-hierarchy of nodes with parent-child relationships

Visual Connections

Links nodes using connection components with customizable styles

Auto-Positioning

Automatic layout management through child manager classes

Rich Formatting

Full control over colors, borders, fonts, gradients, and more

Component Architecture

TeeTree follows a component-based architecture where the Tree acts as a container:
The TCustomTree class is the base class, while TTree is the published component you’ll typically use in your applications.

Global Configuration

TeeTree provides several global variables for fine-tuning behavior:
These global variables might be removed or replaced in future versions. Use with caution.
Adjust list capacities for better performance:

Working with Roots

The Tree maintains a collection of root nodes (nodes without parents):
Root nodes are automatically positioned based on the Tree’s GlobalFormat.ChildManager when their AutoPosition property is enabled.

Layout Management

The Tree’s layout is controlled by the GlobalFormat.ChildManager object:
Child managers determine how parent and children nodes are arranged on screen when nodes are auto-positioned. See Child Managers for details.

Selection Management

TTree provides a built-in selection system:

CrossBox (Expand/Collapse)

The CrossBox is the visual indicator (+/-) for expanding and collapsing nodes:

VCL vs FireMonkey

TeeTree supports both VCL and FireMonkey frameworks:
  • VCL: Uses TeeTree.pas unit
  • FireMonkey: Uses FMXTee.Tree.pas unit
The API is consistent across both frameworks, with minor platform-specific differences in rendering and events.

Common Patterns

Creating a Simple Hierarchy

Iterating All Nodes

Finding Nodes

Best Practices

Use AutoPosition

Enable AutoPosition for automatic layout management instead of manually positioning every node

Set List Capacity

Pre-allocate list capacity for better performance when adding many nodes

Batch Updates

Use BeginUpdate/EndUpdate when making multiple changes to prevent flickering

Choose Right ChildManager

Select the appropriate child manager for your tree’s visual structure

Next Steps

Nodes

Learn about TTreeNodeShape and node hierarchy

Connections

Understand how to link nodes with connections

Child Managers

Explore layout management options