AddTreeControl

>>-anAdvancedControl~AddTreeControl(--id--,--+---------------+--,--x--,--y-->
                                             +-attributeName-+

>--,--cx--,--cy--+--------------------------------+--)---------------------><
                 |       +-------------------+    |
                 |       V                   |    |
                 +-,--"----+-ATROOT--------+-+--"-+
                           +-BUTTONS-------+
                           +-LINES---------+
                           +-EDIT----------+
                           +-HSCROLL-------+
                           +-VSCROLL-------+
                           +-SHOWSELALWAYS-+
                           +-ALL-----------+
                           +-NODRAG--------+
                           +-GROUP---------+
                           +-HIDDEN--------+
                           +-NOTAB---------+
                           +-NOBORDER------+


The AddTreeControl method adds a tree view to the dialog and connects it with a data attribute. For further information on tree view controls, refer to TreeControl Class.

Arguments:

The arguments are:

id

A unique identifier assigned to the control. You need the ID to refer to this control in other methods.

attributeName

The name of the data attribute associated with the dialog item. See attributeName to get information on what happens when this argument is omitted.

x, y

The position of the upper left corner of the control relative to the dialog, in dialog units.

cx, xy

The width and height of the dialog item, in dialog units.

options

This argument determines the behavior and style of the dialog item and can be one or more of the following, separated by blanks:

ATROOT

The tree view has lines linking child items to the root of the hierarchy.

BUTTONS

The tree view adds a button to the left of each parent item.

LINES

The tree view has lines linking child items to their corresponding parent items.

EDIT

The tree view allows the user to edit the labels of tree view items. To store the edited text, you must connect a method to the ENDEDIT notification or connect the DEFAULTEDIT event handler (see ConnectTreeNotify).

HSCROLL

The tree view supports a horizontal scroll bar.

VSCROLL

The tree view supports a vertical scroll bar.

SHOWSELALWAYS

A selected item remains selected when the tree view loses focus.

ALL

The options ATROOT, BUTTONS, LINES, EDIT, HSCROLL, and SHOWSELALWAYS are all applied.

NODRAG

The tree view is prevented from sending "begin drag" notifications.

GROUP

The first control of a group of controls in which the user can move from one control to the next with the arrow key.

HIDDEN

The control is initially hidden.

NOTAB

The tab key cannot be used to move to this control.

NOBORDER

No border is drawn around the control.

Return value:

The possible return values are:

0

Success.

less than 0

Error with the in-memory dialog template or with the resource ID.

Example:

The following example creates a tree view at position x=100 and y=80 and with a size of width=40 and height=120. The ID of the tree is 555 and its data is associated with attribute BRANCH. The tree view uses lines for child items and roots, displays a button to the left of each parent item, and supports item editing.

MyDialog~AddTreeControl(555, "Branch", 100, 80, 40, 120, ,
"LINES BUTTON EDIT ATROOT")