ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

ATL/WTL Ribbon Can't get CheckBox state


Stoic Joker:
   I'm trying to get a project off the ground but seem to have run into a wall out of the gate. Using MSVS2008 I created an ATL/WTL project using the Application Wizard add-on that someone here suggested I try experimenting with. In the App Wizard I added a Ribbon control (because I'm an idiot...), to which I add a group, and in that group I added a CheckBox. So good.

   So the fun started when I created a function for the above mentioned Ribbon Control's CheckBox. The function is supposed to test for the state of the CheckBox...and respond accordingly. Simple I thought. Except no matter what I try I cannot get the control to divulge its own state.

   I have spent the entire day on this, and would dare say I have tried everything except the right answer! I have confirmed that the correct ID for the control in question is indeed being passed to the function ... I just can't seem to do a damn thing with it. The program either crashes, or just ignores me.

   So if anyone familiar with ATL/WTL Ribbon Controls might happen to have a clue what I'm missing they'd be willing to share it would be greatly appreciated. Program is currently being compiled for Unicode...assuming that makes a difference.

Thank you,

Stoic Joker

Stoic Joker:
Hm... So I guess I'll have to answer this one myself.

After some stumbling in the dark with the debugger, it occurred to me - it was bloody obvious with a break point in place actually - that the function was executing before the state I was checking for had been set/changed. So the quandary I guess is/was a side effect of my not working with classes much. *Shrug*

I got out of it by declaring and toggling a module level global, but I'd always understood that as being bad form unless absolutely necessary... :-\ Which apparently for this, it is.


[0] Message Index

Go to full version