![]() |
MDI-ribbon (urgent) |
Post Reply ![]() |
Author | |
znakeeye ![]() Senior Member ![]() ![]() Joined: 26 July 2006 Status: Offline Points: 1672 |
![]() ![]() ![]() ![]() ![]() 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 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello,
In Ribbon it works same. Just add handler to your view.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
znakeeye ![]() Senior Member ![]() ![]() Joined: 26 July 2006 Status: Offline Points: 1672 |
![]() ![]() ![]() ![]() ![]() |
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!
|
|
![]() |
|
znakeeye ![]() Senior Member ![]() ![]() Joined: 26 July 2006 Status: Offline Points: 1672 |
![]() ![]() ![]() ![]() ![]() |
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!
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
ok :)
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
znakeeye ![]() Senior Member ![]() ![]() Joined: 26 July 2006 Status: Offline Points: 1672 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello,
You can activate it manually in OnInitialUpdate of view.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
znakeeye ![]() Senior Member ![]() ![]() Joined: 26 July 2006 Status: Offline Points: 1672 |
![]() ![]() ![]() ![]() ![]() |
Ehm... how? :D
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Call pRibbonBar->SetCurSel(nIndex); |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
znakeeye ![]() Senior Member ![]() ![]() Joined: 26 July 2006 Status: Offline Points: 1672 |
![]() ![]() ![]() ![]() ![]() |
Hah, easy trick as always! =)
Thanks!
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |