CTreeCtrl::SetCheck

BOOL SetCheck( HTREEITEM hItem**, BOOL** fCheck = TRUE );

Return Value

Nonzero if successful; otherwise 0.

Parameters

hItem

The HTREEITEM to receive the check state change.

fCheck

Indicates whether the tree control item is to be checked or unchecked. By default, SetCheck sets the item to be checked.

Remarks

Call this member function to set the check state for a tree control item. When the tree control item is checked (fCheck set to TRUE), the item appears with an adjacent checkmark.

Example

// The pointer to my tree control.
extern CTreeCtrl* pmyTreeCtrl;

UINT i, uCount = pmyTreeCtrl->GetVisibleCount();
HTREEITEM hItem = pmyTreeCtrl->GetFirstVisibleItem();

// Toggle the check state of all the visible items.
for (i=0;i < uCount;i++)
{
   ASSERT(hItem != NULL);
   pmyTreeCtrl->SetCheck(hItem, !pmyTreeCtrl->GetCheck(hItem));
   hItem = pmyTreeCtrl->GetNextVisibleItem(hItem);
}

CTreeCtrl OverviewClass MembersHierarchy Chart

See Also   CTreeCtrl::GetCheck