Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Tri State CheckBox TreeCtrl
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Tri State CheckBox TreeCtrl

 Post Reply Post Reply
Author
Message
jimmy View Drop Down
Senior Member
Senior Member


Joined: 11 November 2003
Location: Austria
Status: Offline
Points: 515
Post Options Post Options   Thanks (0) Thanks(0)   Quote jimmy Quote  Post ReplyReply Direct Link To This Post Topic: Tri State CheckBox TreeCtrl
    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

Back to Top
jimmy View Drop Down
Senior Member
Senior Member


Joined: 11 November 2003
Location: Austria
Status: Offline
Points: 515
Post Options Post Options   Thanks (0) Thanks(0)   Quote jimmy Quote  Post ReplyReply Direct Link To This Post Posted: 12 February 2008 at 8:15am
Have found a solution with standard CTreeCtrl

  Jimmy

Back to Top
theflavor View Drop Down
Newbie
Newbie


Joined: 19 February 2008
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote theflavor Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
jimmy View Drop Down
Senior Member
Senior Member


Joined: 11 November 2003
Location: Austria
Status: Offline
Points: 515
Post Options Post Options   Thanks (0) Thanks(0)   Quote jimmy Quote  Post ReplyReply Direct Link To This Post 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

  Jimmy

Back to Top
kstowell View Drop Down
Admin Group
Admin Group


Joined: 25 January 2003
Location: MIchigan, USA
Status: Offline
Points: 496
Post Options Post Options   Thanks (0) Thanks(0)   Quote kstowell Quote  Post ReplyReply Direct Link To This Post 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<
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.