Professional UI Solutions
Site Map   /  Register
 
 

Forum

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 Tech Support » Update event for ribbon tabs Collapse All
Subject Author Date
Oliver Burkert Jun 11, 2007 - 6:50 AM

Is there a way to enable/disable the tabs in my CExtRibbonBar by handling events of the tabs themselves? I created a CExtRibbonNodeTabPage and gave it a unique CmdID, then I added a handler for ON_UPDATE_COMMAND_UI(myCmdID, myHandlerFunc) and called pCmdUI->Enable(FALSE) in the handler function. However, I never get the event unless I click on the tab. Can’t I enable/disable ribbon tabs just as I do it with menus or buttons?

Oliver Burkert Jun 11, 2007 - 8:04 AM

OK, but unfortunately, OnDeliverCmd doesn’t get called before I click on the tab. I’d like to disable it visually, so the user can se which tabs are active. In some other part of my code, I’m calling CExtRibbonButtonTabPage::ModifyStyle(TBBS_DISABLED), which does exactly what I want, but I’d like to do it in the update event of the tab.

Technical Support Jun 11, 2007 - 9:45 AM

We think it’s not a good idea to make tab buttons controlled by the MFC’s command updating mechanism. Currently all the tabs are always enabled (like in Office 2007 applications) and the developer needs simply to construct the content of the ribbon tree. The developer doesn’t need to add command updating handlers for all the inserted tab items. Besides, we would need to create a skin for disabled tab items, which is outside the requirements of Office 2007 Ribbon UI license and not recommended by the Windows Vista UI guidelines (see msdn2.microsoft.com/en-us/library/aa511493.aspx).



Technical Support Jun 11, 2007 - 7:20 AM

The tab buttons in the ribbon bar are not based on MFC’s command updating mechanism. If you want to disable tab switching , you should use a custom CExtRibbonBar-derived class which implements the bool CExtRibbonBar::OnDeliverCmd( CExtBarButton * pTBB ) virtual method. If the pTBB parameter is kind of the CExtRibbonButtonTabPage type and the method is invoked to switch the selected tab page. If you want to disable tab page switching, the method should not invoke the parent class method and simply return true.