Windows Mobile Developer Network Forum

Windows Mobile Developer Network Forum
It is currently Fri Jul 30, 2010 2:51 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 

Rate this article
1 0%  0%  [ 0 ]
2 0%  0%  [ 0 ]
3 0%  0%  [ 0 ]
4 0%  0%  [ 0 ]
5 0%  0%  [ 0 ]
Total votes : 0
Author Message
 Post subject: QA: How can I create a tree control with checkboxes?
PostPosted: Thu Oct 28, 2004 4:43 pm 
Offline
Site Admin

Joined: Sun Mar 30, 2003 4:04 pm
Posts: 1004
<h2>Question</h2> I am using a tree control in my eVC application. I want to display checkboxes for the tree items. I have selected checkbox option in the properties dialog but when I added nodes to the tree it is not displaying checkboxes. How can I fix it?
<h2>Answer</h2> By some reason the tree control shows checkboxes only when an image list is assigned. If you do not need images in the tree control you can create a dummy image list with images that look like checkboxes.
<h2>Step by step</h2> <ol> <li>Add CTreeCtrl and set "Check Boxes" flag in the control properties (or add <i>TVS_CHECKBOXES</i> style)</li> <li>Create new bitmap resource with the attached picture - <a href="/articles/samples/checkbox.bmp">checkbox.bmp</a>
</li> <li>Add CImageList member variable to your class declaration like:
Code:
CImageList m_il;
</li> <li>Create an image list using the bitmap resource in the initialization function:
Code:
m_il.Create(IDB_CHECKBOX, 16, 0, CLR_NONE);
</li> <li>Assign this image list to the tree control:
Code:
m_ctrlTree.SetImageList(&m_il, TVSIL_STATE);
</li> </ol>
<h2>Sources</h2> You can download a sample project with sources - <a href="/articles/samples/CheckboxTree.zip">CheckboxTree.zip</a> (18Kb).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group