Skip to content

AddTreeItem - AbstractTreeView

Adds an item to a TreeView

Type: Function
Return Data Type: Handle

Parameters

Parameter Type Description
sValue String The text you want displayed for the item
hParent Handle The handle of the item that you want as the parent of this item (pass 0 to create an item with no parent - a root item)
iItemData Integer A custom 32-bit integer value you want to associate with the item
iImage Integer The index of an image in the associated ImageList (which you need to create separately) that will be displayed alongside the item whenever it is not the current-item
iSelImage Integer The index of an image in the associated ImageList that will be displayed alongside the item whenever it is the current item

Syntax

Function AddTreeItem String sValue Handle hParent Integer iItemData Integer iImage Integer iSelImage Returns Handle

Call Example

Get AddTreeItem sValue hParent iItemData iImage iSelImage to HandleVariable

Description

Used to add an item to a TreeView.

Sample

This example creates a root item and adds two children to it. Notice how a symbol is used to associate with the items added. By doing this, we can identify items later (items do not have an index position in the list). We are assuming here that six images have been added into the object's ImageList object (Indexes 0-5). The first image (Index 0) is used for the Food item and the second image is also used for this item, but only when it becomes the current item.

Enum_List
    Define tiFood
    Define tiCake
    Define tiSteak
End_Enum_List

Procedure MyCustomMethod
    Handle hRoot hCake hSteak

    Get AddTreeItem "Food"  0 tiFood  0 1 to hRoot
    Get AddTreeItem "Cake"  hRoot tiCake  2 3 to hCake
    Get AddTreeItem "Steak" hRoot tiSteak 4 5 to hSteak
End_Procedure

The sValue label parameter value can later be retrieved using ItemLabel. The iItemData custom data parameter value can later be retrieved using ItemData.

Return Value

The handle of the added item