Developer Resources

TreeViewItem

Overview

The TreeViewItem represents items on a tree view control.

Constructor

TreeViewItem(label : String, bitmap : Bitmap)

Arguments

label
The label that displays for the item.
bitmap
The bitmap that displays for the item.

Methods

TreeViewItem.getChildCount
Returns the number of children of the treeview item.
TreeViewItem.getFirstChild
Gets the first child of the treeview item.
TreeViewItem.getLabel
Returns the text of the treeview item.
TreeViewItem.getLastChild
Gets the last child of the treeview item.
TreeViewItem.getNextChild
Gets the next child of the treeview item.
TreeViewItem.getNextSibling
Gets the treeview item right after this item.
TreeViewItem.getParent
Gets the parent of a treeview item.
TreeViewItem.getPreviousSibling
Gets the treeview item right before this item.
TreeViewItem.hasChildren
Indicates whether a treeview item has children or not.
TreeViewItem.isExpanded
Indicates whether a treeview item is expanded or not.
TreeViewItem.isSelected
Indicates whether a treeview item is selected or not.
TreeViewItem.isVisible
Indicates whether a treeview item is visible or not.
TreeViewItem.setBitmap
Sets a bitmap for the treeview item.
TreeViewItem.setLabel
Sets the label for a treeview item.

TreeViewItem.getChildCount

function TreeViewItem.getChildCount(all_children : Boolean) : Integer

Arguments

all_children
Flag denoting whether to return all children (true) or just the immediate, first-level children (false).

Returns

Returns the number of children of the treeview item.

Description

Gets the number of children of the treeview item. If all_children is true, then the function counts all child items recursively and returns the total number of children. If all_children is false, then the function only counts the immediate children of the item and returns this number. If all_children isn't specified, the function returns the count of all children.

TreeViewItem.getFirstChild

function TreeViewItem.getFirstChild() : TreeViewItem

Returns

Returns the first child of a treeview item.

Description

Gets the first child of the treeview item and returns it. If the function can't find a first child, the function returns an empty treeview item.

TreeViewItem.getLabel

function TreeViewItem.getLabel() : String

Returns

The text of the treeview item.

Description

Returns the text of the treeview item.

TreeViewItem.getLastChild

function TreeViewItem.getLastChild() : TreeViewItem

Returns

Returns the last child of a treeview item.

Description

Gets the last child of the treeview item and returns it. If the function can't find a last child, the function returns an empty treeview item.

TreeViewItem.getNextChild

function TreeViewItem.getNextChild() : TreeViewItem

Returns

Returns the next child of a treeview item after the last item that was returned from this function of from getFirstChild().

Description

Gets the next child of this item. The next child is the child after the last child that was returned from this function or from getFirstChild(). If the function can't find the next item, it returns an empty treeview item.

TreeViewItem.getNextSibling

function TreeViewItem.getNextSibling() : TreeViewItem

Returns

Returns the treeview item right after this item.

Description

Gets the treeview item right after this item, which is the treeview item that has the same parent as the current item and is right after this item in the tree. If the function can't find the next child item, it returns an empty treeview item.

TreeViewItem.getParent

function TreeViewItem.getParent() : TreeViewItem

Returns

Returns the treeview item parent.

Description

Gets the parent of a treeview item and returns it. If the treeview item doesn't have a parent, the function returns an empty treeview item.

TreeViewItem.getPreviousSibling

function TreeViewItem.getPreviousSibling() : TreeViewItem

Returns

Returns the treeview item right before this item.

Description

Gets the treeview item right before this item, which is the treeview item that has the same parent as the current item and is right before this item in the tree. If the function can't find the previous child item, it returns an empty treeview item.

TreeViewItem.hasChildren

function TreeViewItem.hasChildren() : Boolean

Returns

Returns true if the item has children, and false otherwise.

Description

Indicates whether a treeview item has children or not. If the treeview item has children, the function returns true; otherwise, it returns false. If the treeview item is not part of the treeview, the function also returns false.

TreeViewItem.isExpanded

function TreeViewItem.isExpanded() : Boolean

Returns

Returns true if the item is expanded, and false if it is collapsed.

Description

Indicates whether a treeview item is expanded so that it's children are visible, if present, or whether the treeview item is collapsed so that children are hidden. If the treeview item is expanded, the function returns true. If the treeview item is collapsed, the function returns false. If the treeview item is not part of the treeview, the function also returns false.

TreeViewItem.isSelected

function TreeViewItem.isSelected() : Boolean

Returns

Returns true if the item is selected, and false otherwise.

Description

Indicates whether a treeview item is selected or not. If the treeview item is selected, the function returns true. If the treeview item is not selected, the function returns false. If the treeview item is not part of the treeview, the function also returns false.

TreeViewItem.isVisible

function TreeViewItem.isVisible() : Boolean

Returns

Returns true if the item is visible, and false otherwise.

Description

Indicates whether a treeview item is visible or not. For example, a treeview item may not be visible if it's outside the window or it's the child of a collapsed parent. If the treeview item is visible, the function returns true. If the treeview item is not visible, the function returns false. If the item is not part of the treeview, the function also returns false.

TreeViewItem.setBitmap

function TreeViewItem.setBitmap(bitmap : Bitmap)

Arguments

bitmap
The bitmap to show for the treeview item.

Description

Sets the treeview item's bitmap, specified by bitmap, that will be shown for the treeview item.

TreeViewItem.setLabel

function TreeViewItem.setLabel(label : String)

Arguments

label
The new text for the treeview item.

Description

Sets the treeview item text, specified by label.