Tri State CheckBox TreeCtrl |
Post Reply |
Author | |
jimmy
Senior Member Joined: 11 November 2003 Location: Austria Status: Offline Points: 515 |
Post Options
Thanks(0)
Posted: 12 February 2008 at 6:26am |
Hello,
Is there a way to add a Tri State Checkbox to the CXTTreeCtrl ? I also need a normal image. i use 11.1.3. I known its work with Markup ext. on version 12.0.0. But we can't wait. Jimmy |
|
jimmy
Senior Member Joined: 11 November 2003 Location: Austria Status: Offline Points: 515 |
Post Options
Thanks(0)
|
Have found a solution with standard CTreeCtrl
Jimmy |
|
theflavor
Newbie Joined: 19 February 2008 Status: Offline Points: 1 |
Post Options
Thanks(0)
|
How were you able to solve this? |
|
jimmy
Senior Member Joined: 11 November 2003 Location: Austria Status: Offline Points: 515 |
Post Options
Thanks(0)
|
Hi,
First add own STATE image list m_imageState.Create( 16, 15, ILC_COLOR32 | ILC_MASK, 0, 1); CBitmap bmp; bmp.LoadBitmap(IDB_TRI_STATE_TREE); m_imageState.Add(&bmp, RGB(0,255,255)); SetImageList( &m_imageState, TVSIL_STATE ); int CTriStateTreeCtrl::GetCheck(HTREEITEM hItem) const { return (GetItemState( hItem, TVIS_STATEIMAGEMASK )>>12) - 1; } void CTriStateTreeCtrl::SetCheck(HTREEITEM hItem, int iState) { SetItemState( hItem, INDEXTOSTATEIMAGEMASK(iState+1), TVIS_STATEIMAGEMASK ); RedrawItem(hItem); // TRACE("SetCheck=%u\n", iState); } Bitmap: width = x*16Pixel, height = 15Pixel. 1.icon not used, 2. uncheck, 3.checked, 4.TriState, and other .... Sorry Codejock does not allowed upload bitmap at this time. Also must catch LButtonDown & check TVHT_ONITEMSTATEICON to toggle Check state. Don't forget to catch KEYDOWN-Space to toggle Check state. uploads/20080220_054307_Test_TriStateTr.zip Jimmy |
|
kstowell
Admin Group Joined: 25 January 2003 Location: MIchigan, USA Status: Offline Points: 496 |
Post Options
Thanks(0)
|
The MFC TreeCtrl sample demonstrates how to use a tri-state tree control. Run the sample, you will see the tri-state tree control on the right side of the dialog.
Open the project and look at the "CStateTreeCtrl" class, hope this helps.
Regards,
|
|
Kirk Stowell, President and CEO
CODEJOCK SOFTWARE SOLUTIONS< |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |