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 » Switching between two ribbonbars? Collapse All
Subject Author Date
Martin Baumgaertner Sep 3, 2007 - 10:05 AM

Hello,

depending on two application specific modes I need to switch between two independent ribbonbars. The status of one bar should be the same when switching back to it, i.e. always deleting all nodes and creating them anew would not be a good solution, wouldn’t it? What would be the best way of implementing that?

Martin

Martin Baumgaertner Sep 4, 2007 - 6:16 AM

I tried the following code to switch between two similar tab pages:

void CRibbon::OnViewSwitched()
{
 	m_wndRibbonBar.Ribbon_PageSelectionSet( 0 );

	if ( m_ec_RibbonViewMode == ec_RVM_1 ) // switching
	{
		m_ec_RibbonViewMode = ec_RVM_2;

		m_pTab_1->ModifyFlags( __ECTN_TBB_HIDDEN ); // hiding tab 1

	}
	else if ( m_ec_RibbonViewMode == ec_RVM_2 )
	{
		m_ec_RibbonViewMode = ec_RVM_1; // switching to view 1

		m_pTab_1->ModifyFlags( 0, __ECTN_TBB_HIDDEN ); // showing tab 1

	}

	m_wndRibbonBar.Ribbon_PageSelectionSet( 1 );

  	m_wndRibbonBar._RecalcPositionsImpl();
  	m_wndRibbonBar.Invalidate();
  	m_wndRibbonBar.UpdateWindow();
}
It works as long as the tab page is NOT minimized. If it is getting minimized, my application crashes.

Is there a better way to code such kind of a view/hide switch?

Martin

Technical Support Sep 3, 2007 - 11:45 AM

Although we have some experience in creating two ribbon bars in one frame window and switching their visibility, we would not recommended to use this approach. We would recommend and use one ribbon bar only and re-initialize its content by invoking the CExtRibbonBar::SetButtons() method. You should create and delete several root nodes manually.