The TV_ITEM structure specifies or receives attributes of a tree-view item.
typedef struct _TV_ITEM { tvi UINT mask; HTREEITEM hItem; UINT state; UINT stateMask; LPSTR pszText; int cchTextMax; int iImage; int iSelectedImage; int cChildren; LPARAM lParam; } TV_ITEM, FAR *LPTV_ITEM;
Value |
Meaning |
TVIF_CHILDREN |
The cChildren member is valid. |
TVIF_HANDLE |
The hItem member is valid. |
TVIF_IMAGE |
The iImage member is valid. |
TVIF_PARAM |
The lParam member is valid. |
TVIF_SELECTEDIMAGE |
The iSelectedImage member is valid. |
TVIF_STATE |
The state and stateMask members are valid. |
TVIF_TEXT |
The pszText and cchTextMax members are valid. |
For a list of item state bit flags, see Tree-View Item States. For information about the state image and overlay image indexes, see Tree-View Image Lists.
When setting the state of an item, the stateMask member indicates the
bits of the state member that are valid. When retrieving the state of
an item, the state member returns the current state for the bits
indicated in the stateMask member.
If the structure is receiving item attributes, this member is the pointer to
the buffer that receives the item text.
If this member is the I_IMAGECALLBACK value, the parent window is responsible
for storing the index. In this case, the tree-view control sends the parent a TVN_GETDISPINFO
notification message to get the index when it needs to display the image.
If this member is the I_IMAGECALLBACK value, the parent window is responsible
for storing the index. In this case, the tree-view control sends the parent a TVN_GETDISPINFO
notification message to get the index when it needs to display the image.
Value |
Meaning |
zero |
The item has no child items. |
1 |
The item has one or more child items. |
I_CHILDRENCALLBACK |
The parent window keeps track of whether the item has child items. In this case, when the tree-view control needs to display the item, the control sends the parent a TVN_GETDISPINFO notification message to determine whether the item has child items. |
If the tree-view control has the TVS_HASBUTTONS style, it uses this member to
determine whether to display the button indicating the presence of child
items. You can use this member to force the control to display the button even
though the item does not have any child items inserted. This allows you to
display the button while minimizing the control’s memory usage by inserting
child items only when the item is visible or expanded.
This structure is used with the TVM_GETITEM, TVM_SETITEM, and TVM_INSERTITEM messages. It is also included with many of the notification messages. When the structure is used to retrieve item information, only the structure members indicated by mask contain valid data. All other members are invalid.
TVN_GETDISPINFO, TVM_GETITEM, TVM_INSERTITEM, TVN_SETDISPINFO, TVM_SETITEM