Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - [Solved] CXTPMarkupTreeCtrl: how to modify markups
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[Solved] CXTPMarkupTreeCtrl: how to modify markups

 Post Reply Post Reply
Author
Message
mstj View Drop Down
Newbie
Newbie


Joined: 23 June 2020
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote mstj Quote  Post ReplyReply Direct Link To This Post Topic: [Solved] CXTPMarkupTreeCtrl: how to modify markups
    Posted: 19 March 2021 at 7:05pm
Hello.

I have a CXTPMarkupTreeCtrl in which each branch is a checkbox markup.

<CheckBox IsThreeState='True' IsChecked='False'>Something</CheckBox>

How can I set this control to a "Checked" state simply in code, without any mouse or keyboard intervention?

--- What I know so far ...
I know that I can get a CXTPMarkupUIElement that is stored as an item data on each HTREEITEM like so:

CXTPMarkupUIElement* pUIElement = reinterpret_cast<CXTPMarkupUIElement*>(
                  GetItemData(hItem));


but that doesn't help me set new states for the control unless I find a way to transform that data into a CXTPMarkupCheckBox which I know is possible in response to markup handlers like CXTPMarkupCheckBox::m_pClickEvent, etc ...).  But I don't know how to randomly change a state with code.

Any help appreciated.
Back to Top
dbrookes View Drop Down
Groupie
Groupie


Joined: 30 August 2019
Location: Australia
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote dbrookes Quote  Post ReplyReply Direct Link To This Post Posted: 21 March 2021 at 8:15pm
What I usually do is set the name attribute on your checkbox xaml.

<CheckBox IsThreeState='True' IsChecked='False' Name='my_checkbox'>Something</CheckBox>

That way you can use FindName on your parent UI element to get your checkbox.

auto *pCheckBox = MARKUP_DYNAMICCAST(CXTPMarkupCheckBox, pUIElement->FindName(L"my_checkbox"));

These markup controls have a SetChecked function you can then call.

Hope that helps.
Back to Top
mstj View Drop Down
Newbie
Newbie


Joined: 23 June 2020
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote mstj Quote  Post ReplyReply Direct Link To This Post Posted: 22 March 2021 at 9:33am
Wonderful.  Smile  It worked.
Thank you very much.
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.155 seconds.