Tree Controls

Tree controls display data in a hierarchical format. You can have multiple controls on a single form if you need more than one tree.

The tree itself is assembled from data that you have placed into cache. The data structure you create for this purpose must load at least three columns into cache:

  • Node Value

    This value is used primarily for placing the row as a node in the tree. Every node in the tree requires a value which corresponds to its position in the tree, based on parent node value. The secondary purpose of node value is for identification.

  • Node Description

    This value is used to label each node in the tree for the benefit of the users.

  • Parent Value

    This value is used to indicate which row is its parent. The value corresponds to Node Value. Runtime adds this row as a child node of its parent in the tree.

Based on this data, and given which node value is to be used as the parent, runtime can construct a tree. For example, consider this table of data:

Node Value

Node Description

Parent Value

1

Alpha Manufacturing

0

2

Branch A

1

3

Branch B

1

4

Plant x

2

5

Plant y

2

6

Plant z

3

Given that the root node value is 1, runtime could assemble a tree with this structure:

Alpha Manufacturing
   Branch A
     Plant x
     Plant y
   Branch B
     Plant z

Consequently, you must ensure that the data in the node value and parent value columns correspond such that runtime can derive the hierarchy. Additionally, many of the system functions that you can use to manipulate the tree rely on node value as an identifier. Therefore, you might want to ensure that those values are unique.

You can also use table I/O to provide node data by associating a given node with a particular table handle using the Set Tree Node Handle system function.

Tree controls have no control-specific properties in Form Design Aid (FDA). Additionally, no automatic runtime processing occurs for the control. Tree controls are manipulated by system functions exclusively.