Redigeeri

Jagamisviis:


Tree Control Item Information

Tree controls (CTreeCtrl) have a number of member functions that retrieve information about items in the control. The GetItem member function retrieves some or all of the data associated with an item. This data could include the item's text, state, images, count of child items, and an application-defined 32-bit data value. There is also a SetItem function that can set some or all of the data associated with an item.

The GetItemState, GetItemText, GetItemData, and GetItemImage member functions retrieve individual attributes of an item. Each of these functions has a corresponding Set function for setting the attributes of an item.

The GetNextItem member function retrieves the tree control item that bears the specified relationship to the current item. This function can retrieve an item's parent, the next or previous visible item, the first child item, and so on. There are also member functions to traverse the tree: GetRootItem, GetFirstVisibleItem, GetNextVisibleItem, GetPrevVisibleItem, GetChildItem, GetNextSiblingItem, GetPrevSiblingItem, GetParentItem, GetSelectedItem, and GetDropHilightItem.

The GetItemRect member function retrieves the bounding rectangle for a tree control item. The GetCount and GetVisibleCount member functions retrieve a count of the items in a tree control and a count of the items that are currently visible in the tree control's window, respectively. You can ensure that a particular item is visible by calling the EnsureVisible member function.

See also

Using CTreeCtrl
Controls