ui.Dialog.appendNode

Appends a new node in the specified tree-view.

Syntax

appendNode(
   name STRING,
   index INTEGER )
  1. name is the screen array name.
  2. index is the index of the parent node in the program array (starts at 1).

Usage

The appendNode() method adds a new node under a given parent, when the dialog controls a tree view.

This method must be used when modifying the array of a tree view during the execution of the dialog, for example when implementing a dynamic tree with ON EXPAND / ON COLLAPSE triggers. Before the execution of the dialog, you can fill the program array directly. This includes the context of BEFORE DISPLAY or BEFORE DIALOG control blocks.

When adding rows for a tree view, the id of the parent node and new node matters because that information is used to build the internal tree structure. When calling appendNode(), you pass the index of the parent node under which the new node will be appended. In the program array, the parent-id member of the new node will automatically be initialized with the value of the id of the parent node identifier by the index passed as parameter, then the internal tree structure is rebuilt.

If the parent index is zero, a new root node will be appended.

The method returns the index of the new inserted node.

In the program array, the parent-id member of the new node will automatically be initialized with the value of the id member of the parent node identified by the index.

DISPLAY ARRAY mytree TO sr.*
    ...
    ON EXPAND(id)
       CALL DIALOG.appendNode("sr", id)
       ...
    ...