[Solved] CXTPMarkupTreeCtrl: how to modify markups |
Post Reply |
Author | |
mstj
Newbie Joined: 23 June 2020 Status: Offline Points: 9 |
Post Options
Thanks(0)
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.
|
|
dbrookes
Groupie Joined: 30 August 2019 Location: Australia Status: Offline Points: 70 |
Post Options
Thanks(0)
|
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.
|
|
mstj
Newbie Joined: 23 June 2020 Status: Offline Points: 9 |
Post Options
Thanks(0)
|
Wonderful. It worked. Thank you very much.
|
|
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 |