Addressing specific nodes in Tree script APIs

There is a difference in the way the Windows smart client and the web client operate on nodes addressed from Tree scripting APIs.

See About the FormComponent object.

In a Windows smart client (WinStudio)

In WinStudio, the tree component implements an invisible "dummy" child node that is a place holder for a "real" child node. After a parent node is first expanded, this "dummy" child node is deleted and replaced by the "real" child node(s). When created and loaded, these "real" child node(s) each reference a "dummy" child node and so on as each node is successively expanded. If no "real" child node exists, then this dummy node is simply deleted when the parent is expanded.

When a "dummy" child node is addressed from a script API, WinStudio addresses the specified operation on the parent of that dummy node. In the following example, node index series "0" addresses level 1 node 1. (For more information about addressing specific nodes, see Notes on the Tree Node ID (GUID) and Index Series. )


ThisForm.Components("tree_comp_name").ExpandNodeAt("0")

For example, if the above script method is executed against a tree that has not yet been expanded, the parent node (root node in this case) is expanded. If node 1 of level 1 has already been loaded (expanded from root), then the above script method expands that node. Since the "dummy" child node can only exist on parent nodes that exist and have been loaded, a script method addressing any node in WinStudio at a level and index beyond where a "dummy" child would exist will simply return without performing any action.

In a web client

In the Web Client, the tree component does not implement a "dummy" child node. Therefore, addressing any node that has not yet been loaded via expansion of the parent simply returns without performing any action.

In both the Windows smart client and the web client

Methods executed against nodes that have been "loaded" operate the same in both WinStudio and the Web Client. When writing form script code that is expected to work the same against tree components in both WinStudio and a Web Client, structure the code so that unexpanded child nodes ("dummy" child nodes in WinStudio) are never addressed.

Rubriques liées