TREEVIEW statement

Purpose

A TreeView control displays a set of data items with a parent-child relationship between the items. This creates a hierarchical list of data which can have any number of levels. Each item displays an optional image and a text string. Each time you add an item, you must specify its relationship to existing data items.

Syntax

TREEVIEW DELETE hDlg, id&, hItem
TREEVIEW GET BOLD hDlg, id&, hItem TO datav&
TREEVIEW GET CHECK hDlg, id&, hItem TO datav&
TREEVIEW GET CHILD hDlg, id&, hItem TO datav&
TREEVIEW GET COUNT hDlg, id& TO datav&
TREEVIEW GET EXPANDED hDlg, id&, hItem TO datav&
TREEVIEW GET NEXT hDlg, id&, hItem TO datav&
TREEVIEW GET PARENT hDlg, id&, hItem TO datav&
TREEVIEW GET PREVIOUS hDlg, id&, hItem TO datav&
TREEVIEW GET ROOT hDlg, id& TO datav&
TREEVIEW GET SELECT hDlg, id& TO datav&
TREEVIEW GET TEXT hDlg, id&, hItem TO txtv$
TREEVIEW GET USER hDlg, id&, hItem TO datav&
TREEVIEW INSERT ITEM hDlg, id&, hPrnt, hIAftr, image&, simage&, txt$ TO hItem
TREEVIEW RESET hDlg, id&
TREEVIEW SELECT hDlg, id&, hItem
TREEVIEW SET BOLD hDlg, id&, hItem, flag&
TREEVIEW SET CHECK hDlg, id&, hItem, flag&
TREEVIEW SET EXPANDED hDlg, id&, hItem, flag&
TREEVIEW SET IMAGELIST hDlg, id&, hLst
TREEVIEW SET TEXT hDlg, id&, hItem, txt$
TREEVIEW SET USER hDlg, id&, hItem, NumExpr
TREEVIEW UNSELECT hDlg, id&

hDlg

Handle of the dialog that owns the Treeview.

id&

The control identifier assigned with CONTROL ADD TREEVIEW.

hItem

Handle of a Treeview item, used to uniquely identify the item

datav&

A long integer variable to which result data is assigned.

txtv$

A string variable to which result data is assigned.

hPrnt

Handle of the parent item to insert the new item under.

hIAftr

Handle of the item to insert the new item after.

image&

Image index of the new item

simage&

Selected image index of the new item

txt$

Text to be displayed for the Treeview item

flag&

A long integer value to define specific attributes

hLst

Handle of the ImageList to be used for graphical items.

Remarks

TREEVIEW DELETE hDlg, id&, hItem

The data item specified by the handle hItem is deleted from the TREEVIEW control.

TREEVIEW GET BOLD hDlg, id&, hItem TO datav&

The bold attribute for the data item hItem is retrieved and assigned to the variable datav&.  If the item is bold, the value true (-1) is assigned.  If not bold, the value false (0) is assigned.

TREEVIEW GET CHECK hDlg, id&, hItem TO datav&

The checkmark attribute for the data item hItem is retrieved and assigned to the variable datav&.  If the checkbox is checked, the value true (-1) is assigned.  If not checked, the value false (0) is assigned.

TREEVIEW GET CHILD hDlg, id&, hItem TO datav&

The parent data item specified by hItem is scanned for child data items. If any are found, the handle of the first child is assigned to the variable specified by datav&.  If none are found, the value zero (0) is assigned to datav&.

TREEVIEW GET COUNT hDlg, id& TO datav&

The number of data items in the TREEVIEW is retrieved, and assigned to the long integer variable specified by datav&.

TREEVIEW GET EXPANDED hDlg, id&, hItem TO datav&

The expanded attribute for the data item hItem is retrieved and assigned to the variable datav&.  If the item is expanded, displaying its child data items, the value true (-1) is assigned.  If the item is collapsed, the value false (0) is assigned.

TREEVIEW GET NEXT hDlg, id&, hItem TO datav&

The data item specified by hItem is scanned for sibling data items. The handle of the next sibling is assigned to the variable specified by datav&.  If no next sibling is found, the value zero (0) is assigned to datav&.

TREEVIEW GET PARENT hDlg, id&, hItem TO datav&

The data item specified by hItem is scanned for its parent data item. The handle of the parent is assigned to the variable specified by datav&. If no parent is found, the value zero (0) is assigned to datav&.

TREEVIEW GET PREVIOUS hDlg, id&, hItem TO datav&

The data item specified by hItem is scanned for sibling data items. The handle of the previous sibling is assigned to the variable specified by datav&.  If no previous sibling is found, the value zero (0) is assigned to datav&.

TREEVIEW GET ROOT hDlg, id& TO datav&

The handle of the very first data item (topmost) in the TREEVIEW is retrieved, and assigned to the variable specified by datav&.

TREEVIEW GET SELECT hDlg, id& TO datav&

The handle of the data item currently selected in the TREEVIEW is retrieved, and assigned to the variable specified by datav&.  If there is no current selection, the value zero (0) is assigned.

TREEVIEW GET TEXT hDlg, id&, hItem TO txtv$

The text of a specific data item (specified by the handle hItem) is retrieved from the TREEVIEW control and assigned to the string variable designated by txtv$.

TREEVIEW GET USER hDlg, id&, hItem TO datav&

Each item in a TREEVIEW may have a long integer user value associated with it at the discretion of the programmer.  This user value is assigned with TREEVIEW SET USER and retrieved with TREEVIEW GET USER. The parameter hItem specifies the handle of the user item to be accessed. The returned user value is assigned to the long integer variable specified by datav&.  In addition to these TREEVIEW user values, every DDT control offers an additional eight user values which can be accessed with CONTROL GET USER and CONTROL SET USER.

TREEVIEW INSERT ITEM hDlg, id&, hPrnt, hIAftr, image&, selimage&, txt$ TO hItem

A new data item is added to this TREEVIEW control.  The parameter hPrnt specifies the parent of this item, or zero if item is to be inserted at the root.  The parameter hIAftr specifies the handle of the item after which this new item is to be inserted, or %TVI_FIRST (at the beginning), %TVI_LAST (at the end), %TVI_SORT (alphabetical order).  If an IMAGELIST has been attached, the parameters image& and selimage& specify which image should be displayed (1=first, 2=second, etc.) for normal and selected items.  If no image is needed, the value(s) 0 should be used. The parameter txt$ designates the text string which should be displayed. If the operation is successful, the handle to the new data item is assigned to the variable designated by hItem.  If the operation fails, the value zero is assigned to hItem.

TREEVIEW RESET hDlg, id&

All data items are deleted from the specified TREEVIEW control.

TREEVIEW SELECT hDlg, id&, hItem

The data item specified by the handle hItem is chosen as selected text for the TREEVIEW control, and the selected text is scrolled into a visible position.

TREEVIEW SET BOLD hDlg, id&, hItem, flag&

The bold attribute for the data item specified by hItem is set based upon the value of the flag& parameter.  If flag& is true (non-zero), it is displayed in bold format.  If flag& is false (zero), it is displayed in normal format.

TREEVIEW SET CHECK hDlg, id&, hItem, flag&

The optional checkbox for the data item specified by hItem is set based upon the value of the flag& parameter.  If flag& is true (non-zero), it is checked.  If flag& is false (zero), it is unchecked.

TREEVIEW SET EXPANDED hDlg, id&, hItem, flag&

The expanded attribute for the data item specified by hItem is set based upon the value of the flag& parameter.  If flag& is true (non-zero), it is displayed in expanded format, with its child items visible.  If flag& is false (zero), it is displayed in collapsed format.

TREEVIEW SET IMAGELIST hDlg, id&, hLst

The IMAGELIST specified by hLst is attached to this TREEVIEW control. The images it contains are displayed as needed with each data item. When the TREEVIEW control is destroyed, any attached IMAGELIST is automatically destroyed.

TREEVIEW SET TEXT hDlg, id&, hItem, txt$

The text of a specific data item (specified by the handle hItem) is replaced by the text in the string expression txt$.

TREEVIEW SET USER hDlg, id&, hItem, NumExpr

Each item in a TREEVIEW may have a long integer user value associated with it at the discretion of the programmer.  This user value is assigned with TREEVIEW SET USER, and retrieved with TREEVIEW GET USER. The parameter hItem specifies the handle of the user item to be accessed, while NumExpr is the user value saved for later retrieval.  In addition to these TREEVIEW user values, every DDT control offers an additional eight user values which can be accessed with CONTROL GET USER and CONTROL SET USER.

TREEVIEW UNSELECT hDlg, id&

All items in the TREEVIEW control are set to an unselected state.

See also

Dynamic Dialog Tools, CONTROL ADD TREEVIEW, CONTROL SET COLOR, CONTROL SET FONT, IMAGELIST