TreeView Interface Reference

TreeView control displays a tree of items and allows the user to select one item from the tree. More...

Inheritance diagram for TreeView:

Inheritance graph
Collaboration diagram for TreeView:

Collaboration graph
List of all members.

Public Member Functions

 BeginUpdate ()
 Enables Update mode.
 EndUpdate ()
 Disables Update mode.

Properties

IDispatch *R Items []
 Gets the root of the tree.
IDispatch *R SelectedItem []
 Gets the selected item.
IDispatch *R TopItem []
 Gets the top most visible item.
long R Count []
 Gets the total number of the items in the tree.
IDispatch *RW Images []
 Defines which ImageList will be used to display image for each item in the tree.
IDispatch *RW StateImages []
 Defines which ImageList will be used to display state image for each item in the tree.
VARIANT_BOOL RW HasButtons []
 Specifies whether the TreeView displays expand buttons for items.
VARIANT_BOOL RW HasLines []
 Specifies whether the TreeView displays lines that connected items.
VARIANT_BOOL RW LinesAtRoot []
 Specifies whether the TreeView displays lines that connected items from the root.
VARIANT_BOOL RW ReadOnly []
 Use this property to prevent the user from editing text of an item in the TreeView control.
VARIANT_BOOL RW CheckBoxes []
 Specifies whether the TreeView displays checkboxes for items.
VARIANT_BOOL RW HotTrack []
 Specifies that the items under the mouse pointer are automatically highlighted.
VARIANT_BOOL RW RowSelect []
 Specifies that the entire row containing the item in the TreeView will be selected when an item will be selected.
VARIANT_BOOL RW HideSelection []
 Specifies whether the TreeView displays which item is selected when an another control has focus.
VARIANT_BOOL RW AutoExpand []
 Specifies whether the TreeView automaticly expands the item when the user clicked on an item.
VARIANT_BOOL RW InfoTip []
 Enables hints Hint for items.
VARIANT_BOOL RW CustomDraw []
 When "TRUE" font and colors of an element can be specified by: Font, TextBkColor.
VARIANT_BOOL RW DoubleBuffering []
 When "TRUE" control will be painted with double-buffering, which reduces flicker.
VARIANT_BOOL RW NoIndentState []
 Do not indent the tree view for the expanding buttons.
VARIANT_BOOL RW AutoHScroll []
 Remove the horizontal scroll bar and auto-scroll depending on mouse position.
VARIANT W OnEdited []
 Sets the event handler for the OnEdited event.
VARIANT W OnExpanding []
 Sets the event handler for the OnExpanding event.
VARIANT W OnExpanded []
 Sets the event handler for the OnExpanded event.
VARIANT W OnCollapsing []
 Sets the event handler for the OnCollapsing event.
VARIANT W OnCollapsed []
 Sets the event handler for the OnCollapsed event.
VARIANT W OnItemCheck []
 Sets the event handler for the OnItemCheck event.
VARIANT W OnBeginEdit []
 Sets the event handler for the OnBeginEdit event.
VARIANT W OnDrawItem []
 Sets the event handler for the OnDrawItem event.

Detailed Description

TreeView control displays a tree of items and allows the user to select one item from the tree.

See also the method CreateTreeView of the Frame.

See also TreeViewEvents.

Example:

o = new ActiveXObject("Scripting.WindowSystemObject")

fs = new ActiveXObject("Scripting.FileSystemObject")

f = o.CreateForm(0,0,0,0)

f.ClientWidth = 150
f.ClientHeight = 250
f.CenterControl()
f.Text = "Tree Demo"
f.BorderWidth = 10

Tree = f.CreateTreeView(10,10,250,300)
Tree.Align = o.Translate("AL_CLIENT")

Root = Tree.Items.Add("Root")
for (i = 0; i<3; i++)
{
        Item = Root.Add(i)
        for (j = 0; j<3; j++)
        {
                Item.Add(i+"."+j)
        }
}

Tree.Items.Expand(true)

f.Show()

o.Run()

Result:
TreeView.jpg


Member Function Documentation

BeginUpdate (  ) 

Enables Update mode.

This method prevents updating of the control until the EndUpdate method is called.

EndUpdate (  ) 

Disables Update mode.


Property Documentation

VARIANT_BOOL RW AutoExpand

Specifies whether the TreeView automaticly expands the item when the user clicked on an item.

VARIANT_BOOL RW AutoHScroll

Remove the horizontal scroll bar and auto-scroll depending on mouse position.

Requires Comctl32.dll version 6.

Requires visual styles (Themes).

Requires Windows Vista.

Default value: "FALSE".

See also:
TVS_EX_AUTOHSCROLL in the MSDN.
Since:
1.1.17.

VARIANT_BOOL RW CheckBoxes

Specifies whether the TreeView displays checkboxes for items.

long R Count

Gets the total number of the items in the tree.

VARIANT_BOOL RW CustomDraw

When "TRUE" font and colors of an element can be specified by: Font, TextBkColor.

Default value: "FALSE".

Example:

o = new ActiveXObject("Scripting.WindowSystemObject")

f = o.CreateForm(0,0,0,0)

f.ClientWidth = 120
f.ClientHeight = 200
f.CenterControl()

Tree = f.CreateTreeView(10,10,250,300)
Tree.Align = o.Translate("AL_CLIENT")
Tree.CustomDraw = true
Root = Tree.Items.Add("Root")
for (i = 0; i<2; i++)
{
        Item = Root.Add(i)
        for (j = 0; j<5; j++)
        {
                NewItem = Item.Add(i+"."+j)
                if (j % 2 == 1)
                {
                        NewItem.Font.Color = 0x000000FF
                        NewItem.Font.Bold = true
                }
        }
}

Tree.Items.Expand(true)

f.Show()

o.Run()
Result:
TreeViewColors.jpg

OnDrawItem event also can be used. Example:

o = new ActiveXObject("Scripting.WindowSystemObject")

f = o.CreateForm(0,0,0,0)

f.ClientWidth = 120
f.ClientHeight = 200
f.CenterControl()

Tree = f.CreateTreeView(10,10,250,300)
Tree.Align = o.Translate("AL_CLIENT")
Tree.CustomDraw = true
Root = Tree.Items.Add("Root")
for (i = 0; i<2; i++)
{
        Item = Root.Add(i)
        for (j = 0; j<5; j++)
        {
                NewItem = Item.Add(i+"."+j)
                NewItem.UserData = j
        }
}


function OnDrawItem(Sender,Item)
{
        j = Item.UserData
        if (j % 2 == 1)
        {
                Item.Font.Color = 0x000000FF
                Item.Font.Bold = true
        }       
}

Tree.OnDrawItem = OnDrawItem
Tree.Items.Expand(true)

f.Show()

o.Run()
Result:
TreeViewColors.jpg

Since:
1.1.12.

VARIANT_BOOL RW DoubleBuffering

When "TRUE" control will be painted with double-buffering, which reduces flicker.

Requires Comctl32.dll version 6.

Requires visual styles (Themes).

Requires Windows Vista.

Default value: "FALSE".

See also:
TVS_EX_DOUBLEBUFFER in the MSDN.
Since:
1.1.17.

VARIANT_BOOL RW HasButtons

Specifies whether the TreeView displays expand buttons for items.

VARIANT_BOOL RW HasLines

Specifies whether the TreeView displays lines that connected items.

VARIANT_BOOL RW HideSelection

Specifies whether the TreeView displays which item is selected when an another control has focus.

VARIANT_BOOL RW HotTrack

Specifies that the items under the mouse pointer are automatically highlighted.

Default value: "FALSE".

IDispatch* RW Images

Defines which ImageList will be used to display image for each item in the tree.

VARIANT_BOOL RW InfoTip

Enables hints Hint for items.

Since:
1.1.10.

IDispatch* R Items

Gets the root of the tree.

This is a TreeItem object.

VARIANT_BOOL RW LinesAtRoot

Specifies whether the TreeView displays lines that connected items from the root.

VARIANT_BOOL RW NoIndentState

Do not indent the tree view for the expanding buttons.

Requires Comctl32.dll version 6.

Requires visual styles (Themes).

Requires Windows Vista.

Requires CheckBoxes = "TRUE".

Default value: "FALSE".

See also:
TVS_EX_NOINDENTSTATE in the MSDN.
Since:
1.1.17.

VARIANT W OnBeginEdit

Sets the event handler for the OnBeginEdit event.

This event occurs when an item's text editing started.

Since:
1.1.10.

VARIANT W OnCollapsed

Sets the event handler for the OnCollapsed event.

This event occurs when an item collapsed.

VARIANT W OnCollapsing

Sets the event handler for the OnCollapsing event.

This event occurs when an item is collapsing.

VARIANT W OnDrawItem

Sets the event handler for the OnDrawItem event.

This event occurs when an item's drawing started.

Since:
1.1.12.

VARIANT W OnEdited

Sets the event handler for the OnEdited event.

This event occurs when an item's text edited.

VARIANT W OnExpanded

Sets the event handler for the OnExpanded event.

This event occurs when an item expanded.

VARIANT W OnExpanding

Sets the event handler for the OnExpanding event.

This event occurs when an item is expanding.

VARIANT W OnItemCheck

Sets the event handler for the OnItemCheck event.

This event occurs when an item's checked state changes.

Since:
1.1.10.

VARIANT_BOOL RW ReadOnly

Use this property to prevent the user from editing text of an item in the TreeView control.

VARIANT_BOOL RW RowSelect

Specifies that the entire row containing the item in the TreeView will be selected when an item will be selected.

This property cannot be used in conjunction with the HasLines.

See also:
TVS_FULLROWSELECT in the MSDN.
Default value: "FALSE".

IDispatch* R SelectedItem

Gets the selected item.

IDispatch* RW StateImages

Defines which ImageList will be used to display state image for each item in the tree.

IDispatch* R TopItem

Gets the top most visible item.


WSO 1.1 Documentation. Date modified:Wed Aug 12 18:13:21 2015. (C) Veretennikov A. B. 2004-2015