Print Page | Close Window

Inserting into CXTPMDiframeWnd hosted menu

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=7269
Printed Date: 12 November 2025 at 11:52pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Inserting into CXTPMDiframeWnd hosted menu
Posted By: beatle
Subject: Inserting into CXTPMDiframeWnd hosted menu
Date Posted: 30 May 2007 at 6:57pm
I am converting an MFC application to use Codejock's ribbon bars. The application dynamically adds menu items at startup as it loads plug-ins. Out old code would store away the MainFrame's CMenu* on startup and then call pMenu->InsertMenu to insert items.
 
With a CXTPMDIFrameWnd derived frame window I have a problem, GetMenu() no longer returns the Window's menu so I have to dig a little deeper:
 

CXTPCommandBars* pCommandBars=CGatanApp::GetGatanMainFrame()->GetCommandBars();

_ASSERTE(pCommandBars);

CXTPMenuBar* pMenuBar=pCommandBars->GetMenuBar();

_ASSERTE(pMenuBar);
 
At this point I'm stuck. Can I somehow extract a CMenu from CXTPMenuBar? It doesn't look like it. How do I insert a menu into the existing menu?
 
Thanks.



Replies:
Posted By: Oleg
Date Posted: 31 May 2007 at 12:42am
Hello,
 
You need convert your old code to new. Something like:
 
pMenuBar->GetControls()->Add(xtpControlButton, ID);


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


Posted By: beatle
Date Posted: 31 May 2007 at 10:09am
Originally posted by oleg oleg wrote:

Hello,
 
You need convert your old code to new. Something like:
 
pMenuBar->GetControls()->Add(xtpControlButton, ID);
 
Oleg,
 
Please elucidate, your answer really doesn't help me very much. I need to insert a menu item not add a button.
 
Thanks.


Posted By: Oleg
Date Posted: 01 June 2007 at 7:29am
pMenuBar->GetControls()->Add(xtpControlPopup , ID); for Popup menu.
 
Please check our samples first - they will help you figure out how commandars work.


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


Posted By: beatle
Date Posted: 01 June 2007 at 10:53pm
Originally posted by oleg oleg wrote:

pMenuBar->GetControls()->Add(xtpControlPopup , ID); for Popup menu.
 
Please check our samples first - they will help you figure out how commandars work.
 
Of course I have looked at the samples.
 
I asked how to insert a menu and you told me how to add button. I'm just looking for a little help.


Posted By: Oleg
Date Posted: 02 June 2007 at 3:43am
xtpControlPopup  will add popup button with submenu.
now you can add buttons to this submenu.
 
CXTPControlPopup* pPopup = (CXTPControlPopup*)pMenuBar->GetControls()->Add(xtpControlPopup , ID);
pPopup->GetCommandBar()->GetControls()->Add(...);


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


Posted By: beatle
Date Posted: 02 June 2007 at 12:18pm
Thanks Oleg.



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