I have a subclass of CMFCToolBa开发者_如何学Pythonr that contains a few buttons, one for toggling a setting and the others for displaying the current state (shown one at a time). I need the other buttons to not be clickable- if the user clicks on them, they should not depress. Is there a way to prevent a button from depressing without making it disabled (because then it is grayed out) or to add an icon to a toolbar that has no interaction?
It's been a while since I've done MFC, so I'm not too sure of the name, of the control, but I think you can put an icon in a CLabel (or maybe CLabelImage). You don't want to use a button for this because a button is supposed to be clicked, i.e., it looks push-able. You want something like a label that just shows state, that's what labels are for.
Would it be easier - and potentially saner - to just handle the button press event and reset the button state, and then do nothing
精彩评论