Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » How can i disable a ribbon button Collapse All
Subject Author Date
Ulrich Heinicke Aug 15, 2007 - 1:36 PM

i want disable a ribbon button, maybe for implement an undo function. First the button will be disabled, but later i want to enable the button. In the documentation i didn’t found a function for that.


Suhai Gyorgy Aug 16, 2007 - 1:20 AM

Support’s answer to a similar question:

The MFC’s command updating mechanism is used in the ribbon bar absolutely like in toolbars and menus. So simply add the command updating handler for a button and invoke pCmdUI->Enable( FALSE ) to disable it either in the ribbon bar or menu. Please note that in the RibbonBar sample, all the commands are forcibly made enabled by returning TRUE value in the CMainFrame::OnCmdMsg() virtual method and not invoking parent class methods. If you are using the RibbonBar sample as a start up project, you should fix this issue. The CMainFrame::OnCmdMsg() virtual method typically invokes the main SDI view’s OnCmdMsg() method and the parent class method.