Print Page | Close Window

MDI-ribbon (urgent)

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=5004
Printed Date: 14 May 2024 at 11:56pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: MDI-ribbon (urgent)
Posted By: znakeeye
Subject: MDI-ribbon (urgent)
Date 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



Replies:
Posted By: Oleg
Date 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


Posted By: znakeeye
Date 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!


Posted By: znakeeye
Date 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!


Posted By: Oleg
Date Posted: 09 September 2006 at 8:35am
ok :)

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


Posted By: znakeeye
Date 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.


Posted By: Oleg
Date Posted: 10 September 2006 at 3:40am
Hello,
You can activate it manually in OnInitialUpdate of view.


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


Posted By: znakeeye
Date Posted: 15 October 2006 at 12:30am
Ehm... how? :D


Posted By: Oleg
Date Posted: 15 October 2006 at 1:12pm

Call pRibbonBar->SetCurSel(nIndex);



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


Posted By: znakeeye
Date Posted: 15 October 2006 at 5:11pm
Hah, easy trick as always! =)
Thanks!



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