Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Programmatically show backstage view
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Programmatically show backstage view

 Post Reply Post Reply
Author
Message
jli1 View Drop Down
Groupie
Groupie
Avatar

Joined: 15 November 2016
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote jli1 Quote  Post ReplyReply Direct Link To This Post Topic: Programmatically show backstage view
    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);
        }
    }


Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 16 November 2016 at 9:11am
Hello,

I suppose you have used example from here

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

Regards,
 Oleksandr Lebed
Back to Top
jli1 View Drop Down
Groupie
Groupie
Avatar

Joined: 15 November 2016
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote jli1 Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.