Tree Control Syntax
Syntax
[[%Directives%][.Width[,Height]]Node^<Choice_Array[!Events]]
Argument |
Type |
Description |
%Directives% |
|
|
Width |
N |
The width of the control. |
Height |
N |
The height of the control. |
Node |
C |
The variable that receives the user's selection. |
^< |
C |
Required as shown. |
Choice_Array |
C |
An array of character values. |
Events |
C |
Performance considerations recommend dynamic calculation of event names into a CR-LF delimited string. |
Description
The formatting string %S=BLR% is used to specify that a tree control should be displayed with the familiar boxes and lines.
To set the default choice for the tree control, set the value of Node before running UI_DLG_BOX(). In the following example, setting node to "b.1.A" would cause the tree to open so that "b.1.A" was visible and highlighted.
dim data[10] as C data[1] = "a.1.A" data[2] = "a.1.B" data[3] = "a.2.A" data[4] = "a.2.B" data[5] = "b.1.A" data[6] = "b.1.B" data[7] = "b.2.A" data[8] = "b.2.B" result=ui_dlg_box("Simple Tree",<<%dlg% {ysize=2} [%S=BLR%.32,10node^<data] | <OK> %dlg% ) |

The following diagram shows the tree control and its return value. [Picture]
dim data[10] as C data[1] = "a.1.A" data[2] = "a.1.B" data[3] = "a.2.A" data[4] = "a.2.B" data[5] = "b.1.A" data[6] = "b.1.B" data[7] = "b.2.A" data[8] = "b.2.B" result=ui_dlg_box("Simple Tree",<<%dlg% {ysize=2} [%S=BLR%.32,10node^<data] | <OK>; [.32node] %dlg% ) |

Using the Macro Expansion Symbol
The tree control may optionally use the macro expansion symbol, as illustrated below. I=@images is a reference to the images variable in the example below. [Picture]
images = <<%dlg% list = <<%dlg% ui_dlg_box("Tree Control Images",<<%dlg% |

Note however, that this example could also have been done without a macro expansion as follows:
images = <<%dlg% list = <<%dlg% |
See Also
Macro Expansion Symbol, Xdialog Control Reference, A Simple Tree Control, Adding Navigator Icons to a Tree Control, Adding Images to a Tree Control, Tree Control Events, Explorer Style Dialog Box, Drop Down Tree Control, Xdialog Language Directives and Operators, Tree Control Methods
Supported By
Alpha Five Version 5 and Above