Dynamically Expanding a Tree Control Using Function Calls
Description
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% scripts|!a5.script_enum(2) functions|!a5.udf_enum(2) colors|!a5.color_enum() tables|!a5.table_enum() %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% {wrap=60} {lf}; {hyperlink=Show initial list definition!initial} {sp=3} {hyperlink=Show current list definition!currentList}; {lf}; {lf}; [%X;S=BRL;D="|";%.60,15current^<list]; {lf}; Current selection:; [.60current]; %dlg%,<<%code% if a_dlg_button = "initial" then a_dlg_button = "" showvar(initialList) end if if a_dlg_button = "currentList" then a_dlg_button = "" showvar(list) end if %code%)
Limitations
Desktop applications only.
See Also