Dynamically Expanding a Tree Control Using Function Calls


This dialog shows how the entries in a tree control can by expanded dynamically by specifying function calls in the tree data. This example tree control uses the D directive to define the "|" character as the tree separator. You can define any separator that you want. The X directive indicates that the tree contains dynamically expanded nodes. Each entry in the list initially is of the form: ParentNode |! Function . The text after the "!" is the event handler. The event handler is the code that will execute when that part of the tree is expanded. The event handler is a function call that returns the expanded version of the tree.

dim list as C
dim initialList as C
dim current as C
list = <<%list%
initialList = list

The X directive in the tree control syntax says that functions will be providing the contents of the branches of the tree. The D directive says that the "|" character separates the parent node from the function that defines its branches.

ui_dlg_box("Dynamically Expanded Tree",<<%dlg%
{hyperlink=Show initial list definition!initial}
{hyperlink=Show current list definition!currentList};
Current selection:;
if a_dlg_button = "initial" then

a_dlg_button = ""

end if
if a_dlg_button = "currentList" then

a_dlg_button = ""

end if


Desktop applications only.

See Also