Package Win32::GUI::TreeView

Back to the Packages


Constructor

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

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


Methods

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)

Ensures that the specified NODE is visible in the TreeView.

Expand(NODE, [FLAG])

Opens a NODE of the TreeView; the optional FLAG parameter can indicate different operations:

  1 expand (this is the default)
  2 collapse
  3 toggle (expand if it was collapsed and collapse if it was expanded)

FirstVisible([NODE])

Gets or sets the first visible NODE in the TreeView; if a NODE is given, it is selected and, if possible, it becomes the first visible one; the return value is the handle of the previously first visible. If no NODE is given, returns the handle of the current first visible one.

GetChild(NODE)

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

GetItem(NODE)

See ItemInfo().

GetNextSibling(NODE)

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

GetNextVisible(NODE)

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

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)

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

GetRoot()

Returns the handle of the TreeView root node.

HitTest(X, Y)

Checks if the specified point in the TreeView area is occupied by a node; it returns the handle to the found node or zero if none was found. If called in an array context, it returns an additional value containing more info about the position of the specified point.

Indent([VALUE])

Gets or sets the indentation width, in pixels, between parents and child nodes; if the VALUE is less than the system-defined minimum, it is set to the system-defined minimum.

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])

Gets or sets the check state of the given NODE (valid only if the control was created with the -checkboxes => 1 option).

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.

VisibleCount()

Returns the number of items that can be fully visible in the TreeView.


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.