Print Page | Close Window

Programmatically show backstage view

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=23204
Printed Date: 27 April 2024 at 3:43pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Programmatically show backstage view
Posted By: jli1
Subject: Programmatically show backstage view
Date Posted: 15 November 2016 at 5:13pm
Hi,

I'm using Xtreme ToolkitPro v16.2.4.

I'm trying to figure out how to programmatically show backstage view with the specific tab we want. Just like the user click "File" then click the specific tab.

But I only achieved to pop up a separate view which only shows part of the backstage view(the tab content part). This is not what I want.

The following is the code I wrote, please point out where is wrong:

CXTPRibbonBar* pRibbonBar = DYNAMIC_DOWNCAST(CXTPRibbonBar, GetCommandBars()->GetMenuBar());
ASSERT (pRibbonBar);
CXTPRibbonBackstageView *pView = DYNAMIC_DOWNCAST(CXTPRibbonBackstageView, pRibbonBar->GetSystemButton()->GetCommandBar());

if (pView)
    {
        CXTPControls* pRibbonControls = pView->GetControls();
        int nCount = pRibbonControls->GetCount();

        for (int i=0; i < nCount; i++)
        {
            CXTPRibbonBackstageTab* pTab = DYNAMIC_DOWNCAST(CXTPRibbonBackstageTab, pRibbonControls->GetAt(i));

            if (pTab && (pTab->GetID() == ID_BACKSTAGE_RECENT))
               pView->SetActiveTab(pTab);
        }
    }





Replies:
Posted By: olebed
Date Posted: 16 November 2016 at 9:11am
Hello,

I suppose you have used example from http://forum.codejock.com/forum_posts.asp?TID=23147" rel="nofollow - here

But missed
CXTPRibbonBar* pRibbonBar = DYNAMIC_DOWNCAST(CXTPRibbonBar, GetCommandBars()->GetMenuBar());
ASSERT (pRibbonBar);
pRibbonBar->SetPopuped(0);    //popup Backstage

Regards,
 Oleksandr Lebed


Posted By: jli1
Date Posted: 16 November 2016 at 5:00pm
Thank you very much, Oleksandr.

After I added that missing line, it works now!

But there is a minor problem after the backstage view showed with the specific tab content which is I want, lets say its the tab B.

In backstage menu there is another tab, let's say the tab A, it's the default tab when user click "File".

With my code, when the backstage view shows with tab B, the tab A in menu is highlighted. I have to click tab B menu, then the highlight of tab A is gone.

I guess I need to remove/reset the default tab selection for backstage view, but I don't what is that?


Thanks.



Posted By: olebed
Date Posted: 17 November 2016 at 1:34pm
Originally posted by jli1 jli1 wrote:

In backstage menu there is another tab, let's say the tab A, it's the default tab when user click "File".

With my code, when the backstage view shows with tab B, the tab A in menu is highlighted. I have to click tab B menu, then the highlight of tab A is gone.

I guess I need to remove/reset the default tab selection for backstage view, but I don't what is that?


I have tried to reproduce this with v16.2.4 but  even your code from first message gives errors. Also I can't reproduce your problem with 17.3.



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