Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - MDI-ribbon (urgent)
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

MDI-ribbon (urgent)

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: MDI-ribbon (urgent)
    Posted: 08 September 2006 at 2:53pm

Hi,

I am going to present my application on tuesday, and I really really have go get this working by then. Please, help me out as soon as you can. (Btw, your "Immediate support"-link is dead.)

Consider a general MDI application. Here you bind different menus to different views, and all command routing is handled internally. All you have to do is to add your command handlers in your view and you are done.

Now, with ribbons I simply do not understand how this behavior would be accomplished. As far as I can see, you bind the ribbon to the main frame's menu and then remove the menu from the frame:

CXTPCommandBars* pCommandBars = GetCommandBars();
CMenu menu;
menu.Attach(::GetMenu(m_hWnd));
SetMenu(NULL);
 
QUESTION
How do I route menu commands to the opened view? There must be something really simple that I have missed.
 
Thanks in advance!
/Chris, Sweden
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 09 September 2006 at 6:20am
Hello,
In Ribbon it works same. Just add handler to your view.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 09 September 2006 at 7:32am

Thanks for your fast response.

Here is the ribbon code for my "menu item":
CXTPRibbonGroup* pGroupCompany = pTabCompany->AddGroup(ID_GROUP_COMPANY);
pGroupCompany->Add(xtpControlButton, ID_COMPANY_SEARCH);
 
If I add a handler in CMainFrame, it is being called correctly. However, in CMyView my handler is NOT being called (even if I remove the handler in CMainFrame):
 
ON_COMMAND(ID_COMPANY_SEARCH, CompanySearch)
 
...
 
void CMyView::CompanySearch()
{
    CString str;
    str.Format("CMyView, this: %d", (DWORD)this);
    AfxMessageBox(str);
}
 
Don't I need to somehow route command messages to the views? I know you do this with OnCmdMsg in SDI applications, but in MDI I have no clue.
 
Thanks!
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 09 September 2006 at 8:19am
Hi again!

I solved it. Sorry for bothering you about this ribbon thingy =P. I accidently called wrong OnCmdMsg on my main frame.
 
Thanks anyway!
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 09 September 2006 at 8:35am
ok :)
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 09 September 2006 at 4:39pm
One more thing though... :D
 
When I open a new view (View1), how do I make the Ribbon tab called "View 1" the active one? I don't want the user to have to click on the correct tab in order to see the new view's menu items.
 
Thanks.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 10 September 2006 at 3:40am
Hello,
You can activate it manually in OnInitialUpdate of view.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 15 October 2006 at 12:30am
Ehm... how? :D
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 15 October 2006 at 1:12pm

Call pRibbonBar->SetCurSel(nIndex);

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 15 October 2006 at 5:11pm
Hah, easy trick as always! =)
Thanks!
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.180 seconds.