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 » Dynamically hiding/showing buttons in ribbon Collapse All
Subject Author Date
Oliver Burkert Jun 7, 2007 - 7:31 AM

In my CExtRibbonBar, I want to hide and show buttons dynamically at runtime. What’s the best way to do this?

I tried calling ModifyFlags(__ECTN_TBB_HIDDEN, 0) on the CExtCustomizeCmdTreeNode object, but this doesn’t hide the button immediately; I had to switch to another tab and back before the change became visible.

Oliver Burkert Jun 13, 2007 - 6:02 AM

For the moment, I can work around it by temporarily switching to another page (Ribbon_PageSelectionGet()), hiding the button and switching back.

Oliver Burkert Jun 13, 2007 - 3:38 AM

Yes, this would be a useful feature (although probably too late for our project).

Oliver Burkert Jun 8, 2007 - 7:57 AM

Isn’t there a better way to do this? This sounds quite inelegant to me. My code that builds the ribbon tree (loading it from the resources) is in a central location and used by a dozen different applications. I don’t want to rewrite the code for the creation of the ribbon tree in each application; I just want to hide specific buttons.

Technical Support Jun 8, 2007 - 12:23 PM

The current version of the ribbon bar works with a solid tree data structure that describes the entire ribbon’s content only. In fact, ribbon nodes are persistent, but the ribbon is implemented as a toolbar with a ribbon-like layout. Toolbar buttons are instantiated for the selected ribbon page only. If a ribbon page is unselected, then you can modify its ribbon nodes safely. Otherwise you should reconstruct the ribbon.

We can regard your message as a feature request. It should not be difficult for us to implement this.

Technical Support Jun 7, 2007 - 10:29 AM

You can do this in the same way as when you initialize the ribbon, i.e. you should recreate the ribbon tree and assign it using the CExtRibbonBar::SetButtons() method.