<TreeViewName>.InsertItem

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Modules > UI (User Interface) > CONTROLS > Control Types > TreeView Control > TreeView Control Creation > CONTROL ADD TREEVIEW > Treeview Properties and Methods >

<TreeViewName>.InsertItem

 

Description

 

Inserts item to treeview.

 

Syntax

 

<treeviewName>.Insert(itemText [, parentItem [, afterFlag [, imageList[, image [, bold]]]]])

 

Returns

 

Number, handle of the inserted item.

 

Parameters (Set only)

 

Name

Type

Optional

Meaning

itemText

Number

No

Text for the added item

parentItem

Number

Yes

Handle of the parent item for the added item.

afterFlag

Number

Yes

Handle of the item to add the item afterwards.

 

If needed, pass 0 for parentItem.

imageList

Number

Yes

Handle of the image list

image

Number

Yes

Handle of the image.

 

If needed, pass 0 for imageList.

bold

Number

Yes

True or False

 

Remarks

 

Restrictions

 

See also

 

Examples

 

 ' Use somewhere outside function

 begin controlid

   %controlMyTreeview

  end controlid

 

 ' ...

 

 ' Then in some function create a named treeview control to existing hDlg dialog

  control add treeview name "myTreeview", hDlg, %controlMyTreeview"", 5, 5, 100, 100

  

 ' And manipulate it via properties and methods with ease

  myTreeview.backColor  = rgb(0,10,0)     ' Black

  myTreeview.textColor  = rgb(128,255,64) ' Green

  myTreeview.lineColor  = rgb(255,0,0)    ' Red

  

  myTreeview.itemHeight = 25              ' Inserts "a" as the first item

  

  myTreeview.indent = 50                  ' Offset from the left

   

  long a = myTreeview.insertItem("a")     ' Inserts "a" as the first item

  long b = myTreeview.insertItem("b")     ' Inserts "b" after the "a", automatically on the same level

  

  myTreeview.insertItem("c", a)           ' Inserts "c" as subitem of "a"

  myTreeview.insertItem("d", 0, a)        ' Inserts "d" after "a" on the same level as "a"

  

  myTreeview.select = b

 

  msgbox 0, "Handle of selection: " + myTreeview.selected + $CRLF +

            "Total items: "         + myTreeview.count