.topic ctrl.treeview
.title TreeView
.toc 1 TreeView
.index TreeView
.index AddItem
.index AddChildItem

.h1 TreeView

VB Equivalent: TreeView -- DVX Widget: treeview

A hierarchical tree of expandable/collapsible nodes. Supports multi-select and drag-to-reorder. Items are accessed by depth-first index (0-based).

.h2 Type-Specific Methods

.table
  Method                                  Description
  ------                                  -----------
  AddChildItem parentIndex%, text$        Add a child node under the node at the given index.
  AddItem text$                           Add a root-level node.
  Clear                                   Remove all nodes.
  GetItemText$(index%)                    Returns the text of the node at the given index.
  IsExpanded(index%)                      Returns True if the node at the given index is expanded.
  IsItemSelected(index%)                  Returns True if the node at the given index is selected.
  ItemCount()                             Returns the total number of nodes (all levels).
  SetExpanded index%, expanded            Expand or collapse the node at the given index.
  SetItemSelected index%, selected        Select or deselect the node at the given index.
  SetMultiSelect multi                    Enable or disable multi-select mode.
  SetReorderable reorderable              Enable or disable node reordering.
.endtable

Default Event: Click

.h2 Example

.code
TreeView1.AddItem "Animals"
TreeView1.AddChildItem 0, "Cat"
TreeView1.AddChildItem 0, "Dog"
TreeView1.AddItem "Plants"
TreeView1.AddChildItem 3, "Oak"
TreeView1.SetExpanded 0, True
Print "Items:"; TreeView1.ItemCount()
.endcode

.link ctrl.common.props Common Properties, Events, and Methods
