Print Page | Close Window

Tri State CheckBox TreeCtrl

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=9564
Printed Date: 29 June 2024 at 1:06pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Tri State CheckBox TreeCtrl
Posted By: jimmy
Subject: Tri State CheckBox TreeCtrl
Date 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




Replies:
Posted By: jimmy
Date Posted: 12 February 2008 at 8:15am
Have found a solution with standard CTreeCtrl

  Jimmy



Posted By: theflavor
Date Posted: 19 February 2008 at 5:39pm
Originally posted by jimmy jimmy wrote:

Have found a solution with standard CTreeCtrl

  Jimmy



How were you able to solve this?


Posted By: jimmy
Date Posted: 20 February 2008 at 4:49am
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 - uploads/20080220_054307_Test_TriStateTr.zip

  Jimmy



Posted By: kstowell
Date Posted: 20 February 2008 at 9:06am
Originally posted by jimmy jimmy wrote:

Is there a way to add a Tri State Checkbox to the CXTTreeCtrl ?
 
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<



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net