Re: CTreeCtrl and Checkboxes
- From: Volker Enderlein <volker@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 06 Aug 2008 08:47:45 +0200
Nick Schultz schrieb:
I have a tree structure with multiple DSPs as parent nodes and their reporting errors as the child nodeI did have exactly the same problem yesterday and this is what I came up with from the MSDN documentation:
for example:
|-DSP1
| |-error1
| |-error2
|
|-DSP2
|-error1
|-error2
I want to be able to have checkmarks to select DSPs only. However, if I enable checkboxes, all items get a checkbox.
is there a way to just have the DSP items to have checkboxes?
Nick
To set the checkbox state:
TVITEM tvi = {0};
tvi.mask = TVIF_HANDLE | TVIF_STATE;
tvi.hItem = hParentItem;
tvi.stateMask = TVIS_STATEIMAGEMASK;
tvi.state = INDEXTOSTATEIMAGEMASK(index);
m_wndTree.SetItem(&tvi);
where and index of 0 means not to show a check box, 1 means unchecked, 2 means checked.
To get the check box state:
TVITEM tvi = {0};
// Prepare to receive the desired information.
tvi.mask = TVIF_HANDLE | TVIF_STATE;
tvi.hItem = hItem;
tvi.stateMask = TVIS_STATEIMAGEMASK;
// Request the information.
m_wndTree.GetItem(&tvi);
// Return zero if it's not checked, or nonzero otherwise.
return ((BOOL)(tvi.state >> 12) -1);
BTW you have to construct the TreeCtrl with the TVS_CHECKBOXES style.
Hope that helps, Cheers Volker
--
Volker Enderlein
Tel: +49 (0)371 53119651 Institut für Mechatronik
Fax: +49 (0)371 53119699 Reichenhainer Strasse 88
email: volker@xxxxxxxxxxxxxxxxxx D-09126 Chemnitz
.
- Follow-Ups:
- Re: CTreeCtrl and Checkboxes
- From: Nick Schultz
- Re: CTreeCtrl and Checkboxes
- References:
- CTreeCtrl and Checkboxes
- From: Nick Schultz
- CTreeCtrl and Checkboxes
- Prev by Date: RUNTIME class corrupted issue in VS2005
- Next by Date: Re: How to modify program files in Vista?
- Previous by thread: Re: CTreeCtrl and Checkboxes
- Next by thread: Re: CTreeCtrl and Checkboxes
- Index(es):
Relevant Pages
|