How to Insert a Tree View

Previous Next

To insert a tree view:

1.Use the Windows Designer catalog to open the window, dialog or control class into which you want to insert the tree view.
2.From the menu bar, choose Insert, Tree View, or drag and drop a tree view from the Windows Designer catalog.
3.Select the Tree View object. From the menu bar, choose Insert, Tree View Node, or drag and drop a tree view node from the Windows Designer catalog, as many times as you want tree view nodes in the tree.
For example, if you want your tree view to display employees per department, you need two tree view nodes.
4.Open the Property Inspector for the Tree View. For the Root Nodes property, specify the name of one or more tree view nodes. The value of this property determines which tree view node(s) are displayed in the root of the tree. For example:
Tree View Node 1
For example, if you want to display employees per department, then for the Root Nodes property of the tree view specify the tree view node that is going to retrieve departments.
5.Open the Property Inspector and for each Tree View Node, set the Child Nodes property. For each tree view node, this property determines which node(s) is/are the child node(s) of that tree view node.
For example, if you want to display employees per department, then for the Child Nodes value of the root node, specify the tree view node that is going to retrieve employees.
NOTE: Depending on the complexity of the data structure, you may need to enter more than one Child Node, and/or more than one Root Node. You can enter multiple values in a Property Inspector text box by typing the first value, pressing CTRL+ENTER, typing the second value, and so on. Each of the values will appear on a new line.
6.For each tree view node, set the SQL Query property to determine which data must be represented by that tree view node.
In the example, the query for the department tree view node would be:

SELECT   dep_name

FROM     department

 

The query for the employee tree view node would be:

SELECT   emp_name

FROM     employee

WHERE    dep_name = :DEP_NAME

 

The :dep_name identifier refers to the dep_name column in the query of the department tree view node.