Print Page | Close Window

Get main menu fail

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=1231
Printed Date: 05 May 2024 at 4:39am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Get main menu fail
Posted By: amhigh
Subject: Get main menu fail
Date Posted: 04 October 2004 at 3:40am

Dear Codejock experts:

I use the Visual C++ 6.0 to develop my own application,
and in my application, we use the "CMenu* MainMenu = AfxGetMainWnd()->GetMenu();"
to get the main menu information.  However, after integrate with codejock, the
application halts whenever it hits "CMenu* MainMenu = AfxGetMainWnd()->GetMenu();",
my question:  how can I fix this problem after integrate with Codejock?
or how can I get the main menu so that we can know the main menu information
(such that we can change the caption of the main menu, and know whether it is a separtor,
or it is a popup menu (if it is a popup menu, how can I get the caption in the submenu,)
... etc),

Thanks for any help.

Best Regards.


 




Replies:
Posted By: Oleg
Date Posted: 04 October 2004 at 12:02pm

Xtreme CommandBars don't use CMenu. you must change all code for CommandBars api:

pMainFrame->GetCommandBars()->GetMenuBar();

to add button:

pMenuBar->GetControls()->Add(..)

access:

pMenuBar->GetControls()->GetAt(i)

remove:

pMenuBar->GetControls()->Remove(i)

 

Please, _learn_ all samples we provided.

 



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


Posted By: amhigh
Date Posted: 04 October 2004 at 8:51pm
Originally posted by oleg oleg wrote:

Xtreme CommandBars don't use CMenu. you must change all code for CommandBars api:

pMainFrame->GetCommandBars()->GetMenuBar();

to add button:

pMenuBar->GetControls()->Add(..)

access:

pMenuBar->GetControls()->GetAt(i)

remove:

pMenuBar->GetControls()->Remove(i)

 

Please, _learn_ all samples we provided.

Thanks for point this out.  I appreciate.

After get the menubar, how can I obtain the information of the menu bar?  For example, I used to get th "Caption" of the menubar and be able to chagne it (say, Change the caption of  "Print ..." under the "File" menu to the caption of my own language) with the MFC, now after integrate with Codejock, after I get the menubar, how can I do the same thing as I did it before?  Can you please provide me some hints or any examples? 

 Thanks for your help.

 

 



Posted By: Oleg
Date Posted: 05 October 2004 at 1:08am

pMenuBar->GetControl(0)->GetCommandBar()->GetContro l(9)->SetCaption("Print1");

or pCommandBars->FindControl(..)->SetCaption("Print1");

but better catch INITCOMMANDSPOPUP notifiaction and change caption before popup become visible. See Notifications  sample.



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


Posted By: Ark42
Date Posted: 14 November 2004 at 12:59pm

This is very useful, I just spent a while searching for this, and this is what I was looking for. In order to change menu items, instead of using ON_WM_INITMENUPOPUP, you use ON_XTP_INITCOMMANDSPOPUP() which will call a function like void CMainFrame::OnInitCommandsPopup(CXTPPopupBar* pCommandBar)
And I think you can then call pCommandBar->GetControlPopup()->GetID() and alter the bar if you want from there.
The Notifications is a good resource to look at here.




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