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 General Discussion » Ribbon Collapse All
Subject Author Date
Sergio Buonanno Sep 20, 2010 - 1:29 AM

Prof-UIS MFC ribbon control is quite a complex control to manage and the documentation provided by the help file rather limited. It is possible to get a draft or something that better explains the use of ribbon control and its classes ? At the moment I’m trying to get a clue by analyzing your sample projects and that it’s a very time consuming task I would like to avoid. Thanks.

Technical Support Sep 24, 2010 - 10:24 AM

If you select some tab in the ribbon bar, then it destroys all the toolbar buttons (CExtBarButton) of previously selected tab page and creates toolbar buttons for new tab page. The structure of buttons is defined by the tree of command tree nodes (CExtRibbonNode, CExtCustomizeCmdTreeNode).

Technical Support Sep 24, 2010 - 10:24 AM

This task is similar both for the CExtRibbonBar and CExtRibbonPage controls. You should recreate a tree of command tree nodes (m_pRibbonNode), assign it to the ribbon bar and refresh the ribbon layout:

      m_wndRibbonBar.SetButtons( NULL );
      m_wndRibbonBar.SetButtons( m_pRibbonNode );
      m_wndRibbonBar.Ribbon_UpdateLayout();

Sergio Buonanno Sep 24, 2010 - 10:27 AM

Wouldn’t that remove all ribbon buttons ? I need to change buttons of just one page the other ribbon pages and tabs should remain untouched.

Technical Support Sep 24, 2010 - 12:29 PM

Yes, this will re-create all buttons and this is fast, but visually you will see just a new ribbon layout with/without some button groups.

Technical Support Sep 21, 2010 - 10:16 AM

The ribbon bar is based on command tree nodes and the CExtCustomizeSite class. I.e. the ribbon bar is similar to customizable toolbars and menus. Both customizable toolbars/menus and ribbon bar support cloning of buttons, edit fields and combo boxes. If you run the StyleEditor sample application, press the Alt+Ctrl keys, drag some combo box from toolbar into other toolbar/menu bar, you will see a copy of this combo box is created. If you run the RibbonBar sample application, invoke a context menu over a combo box inside ribbon bar and add it into the quick access toolbar, a copy of combo box will also be created. You can change the value in some combo box and the second combo box will display the same value automatically. This is possible in both sample applications and provided by the CExtCustomizeSite class. We cannot use combo box common controls inside the ribbon bar and customizable toolbars and menus.

Sergio Buonanno Sep 21, 2010 - 6:34 AM

It is not about anything particularly difficult but some documentation like you have for other features would be of great help. In the help system there are some very useful articles. It would be nice to have the same thing for the ribbon bars. There are several classes involved in the creation of a complex ribbon bar; for example your ribbon sample application has hundreds of lines of code just to build up the ribbon bar but the help file is quite skimpy. Just adding a combo box on the ribbon bar could be a rather complex task and it isn’t properly documented.

Technical Support Sep 20, 2010 - 10:22 AM

The CExtRibbonBar control just displays a set of buttons described by the tree data structure containing command tree nodes (CExtRibbonNode, CExtCustomizeCmdTreeNode). Most of the nodes are CExtRibbonNode and they describing tab pages, button groups and command buttons. The CExtCustomizeCmdTreeNode nodes describing menu items dropped from the drop down command buttons. Most of the buttons are parts of tab pages. But there are two additional group of buttons: quick access toolbar and "right buttons" displayed at the right side of the tabs. That’s mostly all you need to know. We would be happy to write some big article about this. Could you please ask us questions about every detail which was difficult for you?

Sergio Buonanno Sep 24, 2010 - 9:30 AM

About changing dynamically the page buttons as described above, I’ve encountered another problem. When I change buttons and the page is hidden all is ok, but if I perform that task when the page is visible and active I get an exception.

Sergio Buonanno Sep 24, 2010 - 7:29 AM

I try to be more specific on a problem I’m facing now. In my MDI application I have a ribbon page that should change dinamically showing different buttons for different windows. I’m having some problems in finding the page I need, then delete the buttons and create new buttons everytime I change document.

Sergio Buonanno Sep 21, 2010 - 6:35 AM

It is not about anything particularly difficult but some documentation like you have for other features would be of great help. In the help system there are some very useful articles. It would be nice to have the same thing for the ribbon bars. There are several classes involved in the creation of a complex ribbon bar; for example your ribbon sample application has hundreds of lines of code just to build up the ribbon bar but the help file is quite skimpy. Just adding a combo box on the ribbon bar could be a rather complex task and it isn’t properly documented.