Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Get main menu fail
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Get main menu fail

 Post Reply Post Reply
Author
Message
amhigh View Drop Down
Newbie
Newbie


Joined: 23 September 2004
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote amhigh Quote  Post ReplyReply Direct Link To This Post Topic: Get main menu fail
    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.


 

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: 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
Back to Top
amhigh View Drop Down
Newbie
Newbie


Joined: 23 September 2004
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote amhigh Quote  Post ReplyReply Direct Link To This Post 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.

 

 

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: 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
Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post 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.



Edited by Ark42
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.188 seconds.