SEC_TREECLASS::SetItem

Sets the attributes of the specified item.

Defined in: trcore.inl

Syntax

SetItem(TV_ITEM* pTVI)

SetItem(const LV_ITEM* pLVI, BOOL bRedraw=TRUE)

SetItem(HTREEITEM hItem, UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam)

Return Value

Nonzero if successful; otherwise 0.

Parameters

pTVI

A pointer to a TV_ITEM structure that contains the new item attributes.

pLVI

A pointer to an LV_ITEM structure.

bRedraw

If the item will be redrawn with the new attributes.

hItem

Handle of the item whose attributes are to be set.

nMask

Integer specifying which attributes to set.

lpszItem

Pointer to a string containing the item’s text.

nImage

Index of the item’s image in the tree view control’s image list.

nSelectedImage

ndex of the item’s selected image in the tree view control’s image list.

nState

Specifies values for the item’s states.

nStateMask

Specifies which states are to be set.

lParam

A 32-bit application-specific value associated with the item.

Comments

Call this function to set the attributes of the specified tree view item. In the TV_ITEM structure, the hItem member identifies the item, and the mask member specifies which attributes to set. If the mask member or the nMask parameter specifies the TVIF_TEXT value, the pszText member or the lpszItem is the address of a null-terminated string and the cchTextMax member is ignored. If mask (or nMask) specifies the TVIF_STATE value, the stateMask member or the nStateMask parameter specifies which item states to change and the state member or nState parameter contains the values for those states.

Note that the second version of this function is virtual, passing a pointer to an LV_ITEM structure. See the MFC documentation for complete information on these structures.