## Package Win32::GUI::TreeView

Back to the Packages

- Constructor

  - new Win32::GUI::TreeView(PARENT, %OPTIONS)

- Methods

  - BackColor([COLOR])

  - ChangeItem(NODE, %OPTIONS)

  - Clear([NODE])

  - Collapse(NODE)

  - Count()

  - DeleteItem(NODE)

  - EnsureVisible(NODE)

  - Expand(NODE, [FLAG])

  - FirstVisible([NODE])

  - GetChild(NODE)

  - GetItem(NODE)

  - GetLastVisible()

  - GetNextSibling(NODE)

  - GetNextVisible(NODE)

  - GetParent(NODE)

  - GetPrevSibling(NODE)

  - GetPrevVisible(NODE)

  - GetRoot()

  - HitTest(X, Y)

  - Indent([VALUE])

  - InsertItem(%OPTIONS)

  - ItemCheck(NODE, [VALUE])

  - ItemInfo(NODE)

  - Reset()

  - Select(NODE, [FLAG])

  - SelectedItem()

  - SetImageList(IMAGELIST, [TYPE])

  - Sort(NODE)

  - TextColor([COLOR])

  - VisibleCount()

- Events

  - Collapse(NODE)

  - Collapsing(NODE)

  - Expand(NODE)

  - Expanding(NODE)

  - KeyDown(KEY)

  - NodeClick(NODE)

### Constructor

new Win32::GUI::TreeView(PARENT, %OPTIONS)

  Creates a new TreeView object can also be called as PARENT->AddTreeView(%OPTIONS).

### Methods

BackColor([COLOR])

  Gets or sets the background color for the control.

ChangeItem(NODE, %OPTIONS)

  Change most of the options used when the item was created (see InsertItem()). Allowed `%OPTIONS` are:

          -bold
          -image
          -selected
          -selectedimage
          -text

Clear([NODE])

  Deletes all nodes from the TreeView if no argument is given; otherwise, delete all nodes under the given NODE.

Collapse(NODE)

  Closes a NODE of the TreeView.

Count()

  Returns the number of nodes in the TreeView.

DeleteItem(NODE)

  Removes the specified NODE from the TreeView.

EnsureVisible(NODE)

  [TBD]

Expand(NODE, [FLAG])

  [TBD]

FirstVisible([NODE])

  [TBD]

GetChild(NODE)

  Returns the handle of the first child node for the given NODE.

GetItem(NODE)

  See ItemInfo().

GetLastVisible()

  [TBD]

GetNextSibling(NODE)

  Returns the handle of the next sibling node for the given NODE.

GetNextVisible(NODE)

  [TBD]

GetParent(NODE)

  Returns the handle of the parent node for the given NODE.

GetPrevSibling(NODE)

  Returns the handle of the previous sibling node for the given NODE.

GetPrevVisible(NODE)

  [TBD]

GetRoot()

  Returns the handle of the TreeView root node.

HitTest(X, Y)

  [TBD]

Indent([VALUE])

  [TBD]

InsertItem(%OPTIONS)

  Inserts a new node in the TreeView. Allowed `%OPTIONS` are:

          -bold => 0/1, default 0
          -image => NUMBER
              index of an image from the associated ImageList
          -item => NUMBER
              handle of the node after which the new node is to be inserted,
              or one of the following special values:
                  0xFFFF0001: at the beginning of the list
                  0xFFFF0002: at the end of the list
                  0xFFFF0003: in alphabetical order
              the default value is at the end of the list
          -parent => NUMBER
              handle of the parent node for the new node
          -selected => 0/1, default 0
          -selectedimage => NUMBER
              index of an image from the associated ImageList
          -text => STRING
              the text for the node

ItemCheck(NODE, [VALUE])

  [TBD]

ItemInfo(NODE)

  Returns an associative array of information about the given NODE:

          -children
          -image
          -parent
          -selectedimage
          -state
          -text

Reset()

  Deletes all nodes from the TreeView.

Select(NODE, [FLAG])

  Selects the given NODE in the TreeView; the optional FLAG parameter can be set to 5 if you want the selected NODE to become, if possible, the first visible item in the TreeView. If NODE is 0 (zero), the selected item, if any, is deselected.

SelectedItem()

  Returns the handle of the currently selected node.

SetImageList(IMAGELIST, [TYPE])

  [TBD]

Sort(NODE)

  Sorts the childs of the specified NODE in the TreeView.

TextColor([COLOR])

  Gets or sets the text color for the control.

VisibleCount()

  [TBD]

### Events

Collapse(NODE)

  Sent when the user closes the specified NODE of the TreeView.

Collapsing(NODE)

  Sent when the user is about to close the specified NODE of the TreeView. The event should return 0 to prevent the action, 1 to allow it.

Expand(NODE)

  Sent when the user opens the specified NODE of the TreeView.

Expanding(NODE)

  Sent when the user is about to open the specified NODE of the TreeView The event should return 0 to prevent the action, 1 to allow it.

KeyDown(KEY)

  Sent when the user presses a key while the TreeView control has focus; KEY is the ASCII code of the key being pressed.

NodeClick(NODE)

  Sent when the user clicks on the specified NODE of the TreeView.