Print Page | Close Window

OnUpdateRibbonTab

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=14610
Printed Date: 27 February 2025 at 5:26pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: OnUpdateRibbonTab
Posted By: MGebler
Subject: OnUpdateRibbonTab
Date Posted: 24 June 2009 at 11:03am
Big problems in version 12. Have a look at your RibbonMDI sample an insert the highlighted line

void CMainFrame::OnUpdateRibbonTab(CCmdUI* pCmdUI)
{
    CXTPRibbonControlTab* pControl = DYNAMIC_DOWNCAST(CXTPRibbonControlTab, CXTPControl::FromUI(pCmdUI));
    if (!pControl)
        return;

    CXTPRibbonTab* pTab = pControl->FindTab(ID_TAB_EDIT);
    if (!pTab)
        return;

    pTab->SetVisible( FALSE );

    // ...

    pTab->SetVisible(MDIGetActive() != NULL);
}

Try to select the EDIT Tab -> Nothing happens.

And now the real life problem. In my MDI-application the childframes decide whether a tab or group is visible or not. Therefore I have to hide all ribbon tabs and groups; dispatch the update command to the views of a child frame, andf if one of these views is responsible for the command they show the tab/group (SetVisible(TRUE), if they are not responsible they do nothing.

Plese help me






Replies:
Posted By: Oleg
Date Posted: 26 June 2009 at 5:23am
This scenario works for me.
 
In Main Frame add
 
 
void CMainFrame::OnUpdateRibbonTab(CCmdUI* pCmdUI)
{
 CXTPRibbonControlTab* pControl = DYNAMIC_DOWNCAST(CXTPRibbonControlTab, CXTPControl::FromUI(pCmdUI));
 if (!pControl)
  return;
 CXTPRibbonTab* pTab = pControl->FindTab(ID_TAB_EDIT);
 if (!pTab)
  return;
 pTab->SetVisible( FALSE );
}
 
in your view
 
void CRibbonMDISampleView::OnUpdateRibbonTab(CCmdUI* pCmdUI)
{
 CXTPRibbonControlTab* pControl = DYNAMIC_DOWNCAST(CXTPRibbonControlTab, CXTPControl::FromUI(pCmdUI));
 if (!pControl)
  return;
 
 CXTPRibbonTab* pTab = pControl->FindTab(ID_TAB_EDIT);
 if (!pTab)
  return;
 
 pTab->SetVisible(TRUE);
}
now Tab is visible only when View is active.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net