CTreeCtrl::SetItemStateEx
Sets the extended state of the specified item in the current tree-view control.
BOOL SetItemStateEx(
HTREEITEM hItem,
UINT uStateEx
);
Parameters
Parameter |
Description |
---|---|
[in] hItem |
Handle to a tree-view control item. |
[in] uStateEx |
The extended state of the item. For more information, see the uStateEx member of the TVITEMEX structure. |
Return Value
true if this method is successful; otherwise, false.
Remarks
This method sends the TVM_SETITEM message, which is described in the Windows SDK. This method assigns the uStateEx parameter to the uStateEx member of a TVITEMEX structure, and then uses that structure in the message.
Requirements
Header: afxcmn.h
This method is supported in Windows Vista and later.
Additional requirements for this method are described in Build Requirements for Windows Vista Common Controls.
Example
The following code example defines a variable, m_treeCtrl, that is used to access the current tree-view control. The code example also defines an unsigned integer and several HTREEITEM variables. These variables are used in the next example.
public:
// Variable to access tree control.
CTreeCtrl m_treeCtrl;
// Variable to access splitbutton control.
CSplitButton m_splitbutton;
// Accessibility identifier
UINT accIdUS;
// HTREEITEMs
HTREEITEM hCountry;
HTREEITEM hPA;
HTREEITEM hWA;
The following code example sets a tree-view item to disabled state. In an earlier section of the code example, which is not shown, we created a tree-view that consists of a root country/region node for the United States, subnodes for the states of Pennsylvania and Washington, and tree items for cities in those states. This code example sets the Pennsylvania node to disabled state.
// Disable the Pennsylvania node.
m_treeCtrl.SetItemStateEx( hPA, TVIS_EX_DISABLED );