The MFC CMFCRibbonCheckBox
class only supports IsChecked()
.
How do I change check status of ribbon check box in program code?
Is there way to set check status like CButton::SetCheck()
.
Asked
Active
Viewed 554 times
0

Hill
- 3,391
- 3
- 24
- 28
1 Answers
1
you can copy code from CMFCRibbonCmdUI::SetCheck. CMFCRibbonBaseElement::m_bIsPressed is a protected member so you need to expose it via a derived class. CMFCRibbonCmdUI has a backdoor to it through class friendship.

Sheng Jiang 蒋晟
- 15,125
- 2
- 28
- 46
-
It seems that there is no chance to add derived class into ribbon control that is created by an Ribbon resource editor. – Hill Sep 06 '17 at 06:48
-
1CMFCRibbonConstructor::CreateElement is virtual... but it is a lot of work to use a derived CMFCRibbonConstructor. much easier if you can use CMFCRibbonCmdUI directly. – Sheng Jiang 蒋晟 Sep 07 '17 at 02:00