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
- 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.
- 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.
- 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.
- 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.
- 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.
- The tree view object has the Role property ROLE_SYSTEM_OUTLINE. Each item in the tree view has the Role property ROLE_SYSTEM_OUTLINEITEM.
- 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
- 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".
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.