Parent Child Control System Functions

This section discusses the system functions unique to the parent child control.

In general, you can use system functions to perform these types of tasks in the parent child control:

  • Affect user interactions with the control.

  • Acquire information about a node.

  • Load data into the control.

  • Format data in the control.

Users have the ability to change the tree's hierarchical structure by moving nodes up and down. Users can also increase the indent or outdent of a node as well. To prevent vertical changes to the tree structure, use Suppress Node Move Up/Down. To prevent horizontal changes, use Suppress Node Indent/Outdent. Typically, you will call these system functions inside the events, Node Indent Verify Before, Node Outdent Verify Before, Node Move Up Verify Before, or Node Move Down Verify Before, to prevent the user from performing the action (move up/down or indent/outdent).

Under most conditions, each node in the tree has a bitmap next to it for display purposes only. You can use Set Tree Node Clickable Bitmap to provide an additional bitmap which is clickable; that is, clicking the bitmap causes the event, Tree Node Bitmap is Clicked, to fire.

You can use system functions to acquire this information about any node in the tree:

  • Given its location, the node ID (Get Node ID).

  • Given its ID, the node row number (Get Row Number).

  • Given its ID, the node parent, siblings, and child IDs (Get Related Node ID).

When application logic is used to load the tree instead of the runtime logic, the application must often insert a tree node at a specific location based on data column values. To achieve this, at design time, select a column to be the node ID column. An application can specify a column as the node ID column. The value in this column will be used as a unique identifier for that row. The node ID column can be any data type, but must be unique. Use the system functions, Insert Grid Buffer Row By Node ID and Get Related Node ID, to specify a node ID column. Node ID column and these system functions work together: Node ID column needs to exist for these system functions to work. If none of these system functions is called, you do not need to specify a node ID column.

After you specify a node ID column, use the Insert Grid Buffer Row By Node ID system function to insert a row at any location, based on its node ID value and Insert As parameter. Use this method to permit an application to insert tree nodes at any position of the tree. Calling the Insert Grid Buffer Row By Node ID system function is the only way to add an entry row in the parent child control.

The parent child control provides some default bitmaps for tree nodes that are displayed to indicate the current status of that node (expanded, collapsed, and so forth). You can substitute your own bitmap to display for a node, however, with Set Tree Node Bitmap.

For each node, the parent child control can automatically generate and update hierarchical numbers called location indicators. If you enable the feature at design time, then users will see the location indicators button at runtime. By default, the numbering schema is 1, 1.1, 1.2, 1.3, 2, 2.1, and so on. You cannot modify the location indicator in any other way.

To insert an entry row in an empty parent child control, you must first call the system function, Set Root Node ID, to assign an ID to the hidden root node. By default, the root node in an empty tree is hidden, and therefore has no ID. After assigning an ID to the root node, then call the system function, Insert Grid Buffer Row By Node ID, and pass in the root node ID. If the control does not have a node ID column, runtime produces an error.