• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Enable/Disable Toolbar *Buttons* :: MFC

kuphryn

Senior member
Hi.

I would like to enable and disable one or more toolbar *buttons*. According to what Prosise mentioned, it can be done using the Enable() that the framework passes to a menu/toolbar update message handler. However, I am not quite clear on how to disable a specific toolbar button. For example, let say I have a toolbar with five buttons.

[button1][button2][button3][button4][button5]

How would I enable/disable, say, button2?

Thanks,
Kuphryn
 
Just create a handler for UPDATE_COMMAND_UI for the toolbar using ClassWizard.

Then, you can just do:

pCmdUI->Enable( conditional_statement );

Which will enable/disable the button based on conditional_statement (see pCmdUI->Enable(...) in MSDN)
 
Back
Top