Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library

Tree View Control

A tree view control displays a hierarchical list of items using lines to connect related items in a hierarchy. Each item consists of a label and an optional bitmap. Windows Explorer uses a tree view control to display directories.

The window class name for a tree view control is WC_TREEVIEW, which is defined as "SysTreeView" in Commctrl.h.

Supported Properties and Methods

accDoDefaultAction
The tree view object itself does not have a DefaultAction method. Depending on the State property of an item in the tree view, DoDefaultAction either expands or collapses the specified item.
accHitTest
accLocation
accNavigate
accSelect
get_accChild
get_accChildCount
The ChildCount property for the tree view object is the number of items contained in the tree view. The ChildCount property for each tree view item is zero.
get_accDefaultAction
The tree view object itself does not have a DefaultAction property. An item in the tree view that is expanded has "Collapse" as its DefaultAction property, and an item that is not expanded has "Expand" as its DefaultAction property.
get_accDescription
get_accFocus
get_accHelp
get_accHelpTopic
get_accKeyboardShortcut
get_accName
The Name property for the tree view object is obtained from the control's window text (or caption). This text is not displayed with the tree view control, so server developers must provide meaningful text in the control's resource definition statement to help users of client utilities to identify the control. The Name property for an item in the tree view is the text displayed in the tree view item.
get_accParent
The Parent property of the tree view object is a window (ROLE_SYSTEM_WINDOW) that surrounds the control and has the same Name property and window class name as the control. The Parent property of each item in the tree view is the tree view object.
get_accRole
The tree view object has the Role property ROLE_SYSTEM_OUTLINE. Each item in the tree view has the Role property ROLE_SYSTEM_OUTLINEITEM.
get_accSelection
get_accState
The State property for the tree view is a combination of one or more of the following values:

STATE_SYSTEM_INVISIBLE | STATE_SYSTEM_UNAVAILABLE | STATE_SYSTEM_FOCUSED | STATE_SYSTEM_FOCUSABLE

For the tree view items, the State property includes either STATE_SYSTEM_EXPANDED or STATE_SYSTEM_COLLAPSED.

Additional possible values for the State property include:

STATE_SYSTEM_FOCUSED | STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_SELECTABLE | STATE_SYSTEM_SELECTED | STATE_SYSTEM_HOTTRACKED

get_accValue
The tree view object does not have a value. The Value property for each tree view item is the indentation level of the item in the hierarchy. For example, in Windows Explorer, the item "Desktop" has a Value property of "0"; the item "My Computer", which is at the next level in the hierarchy, has a Value property of "1"; and each of the disk drives, which are at the next level in the hierarchy, have a Value property of "2".

Events Generated

EVENT_OBJECT_CREATE

EVENT_OBJECT_DESTROY

EVENT_OBJECT_FOCUS

EVENT_OBJECT_SELECTION

EVENT_OBJECT_SELECTIONADD

EVENT_OBJECT_SELECTIONREMOVE

EVENT_OBJECT_STATECHANGE

EVENT_OBJECT_NAMECHANGE

Remarks

The accLocation property of tree view items returns the location only of the text in the item. The coordinates returned by accLocation for tree view items do not include the icon located to the left of the text.

See Also

IAccessible Interface

Community Additions

Show:
© 2015 Microsoft