Print Page | Close Window

[Solved] CXTPMarkupTreeCtrl: how to modify markups

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=24142
Printed Date: 23 November 2024 at 9:10pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [Solved] CXTPMarkupTreeCtrl: how to modify markups
Posted By: mstj
Subject: [Solved] CXTPMarkupTreeCtrl: how to modify markups
Date 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.



Replies:
Posted By: dbrookes
Date 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.


Posted By: mstj
Date Posted: 22 March 2021 at 9:33am
Wonderful.  Smile  It worked.
Thank you very much.



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