Enable/Disable Toolbar *Buttons* :: MFC

kuphryn

Senior member
Jan 7, 2001
400
0
0
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
 

singh

Golden Member
Jul 5, 2001
1,449
0
0
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)