Reputation: 3191
I have a Ribbon UI for an MFC application. During certain processes, I would like to disable certain controls on the ribbon, so that the user generated events for those controls are no longer processed, until thee control is enabled back again. Does anyone know this could be done? I have looked through the API for the ribbon controls, but didnt see a SetEnable method or something similar.
CMFCRibbonComboBox* pMyComboBox = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(ID_THIS));
// pMyComboBox->SetEnable(FALSE); // I am looking for something similar if it exists
Upvotes: 0
Views: 946
Reputation: 4590
MFC typically handles the updating of UI elements (eg. toolbar buttons, controls, etc.) via the ON_UPDATE_COMMAND_UI message handler.
ON_UPDATE_COMMAND_UI(id, memberFxn )
Basically, you code a handler for the control you want to enable/disable etc. When it gets called you will be passed a pointer to a CCmdUI object that will allow you to change the state of the control. Have look here for more info.
Upvotes: 2