Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPMenuBar - need pointer to CMenu
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPMenuBar - need pointer to CMenu

 Post Reply Post Reply
Author
Message
tralfaz View Drop Down
Groupie
Groupie


Joined: 21 June 2009
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote tralfaz Quote  Post ReplyReply Direct Link To This Post Topic: CXTPMenuBar - need pointer to CMenu
    Posted: 01 July 2009 at 7:40pm
Is there a way to get my hands on the CMenu associated with the CXTPMenuBar?

OnCreate I'm adding the menu bar:

CXTPMenuBar* pMenuBar = pCommandBars->SetMenu(_T("Menu"), IDR_MAINFRAME);

Next I want to modify the Menu and attach custom menu items. If I could get a pointer to a CMenu then I could use my existing routine.

How do you add menu items after the fact?

I need something like this:
   
CXTPMenuBar* pxMenu = GetCommandBars()->GetMenuBar();
CMenu* pMenu = pxMenu->GetMenu();

ModifyMenu(pMenu);

or this

CMenu Menu;
Menu.LoadMenu(IDR_MAINFRAME);
ModifyMenu(&Menu);
CXTPMenuBar* pMenuBar = pCommandBars->SetMenu(&Menu);



Thanks,
Matt

XP Pro SP3 / VS2008 C++ / Xtreme CommandBars v13.1.0
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2009 at 10:21am
I don't believe there is a CMenu behind the command bar. You can first use a CMenu to load and manipulate your menu layout and then pass the CMenu to CJ. I do that when building the command ribbon (I might have to get the controls collection and then pass it the menu; I'm not at work so I can't explicitly check on exactly what call I make or whether the call takes in a CMenu or HMENU - CMenu can be cast to HMENU).
Back to Top
tralfaz View Drop Down
Groupie
Groupie


Joined: 21 June 2009
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote tralfaz Quote  Post ReplyReply Direct Link To This Post Posted: 07 July 2009 at 11:59am
rd - if you have that call that passes in a CMenu to MenuBar, I'd really appreciate it.

XP Pro SP3 / VS2008 C++ / Xtreme CommandBars v13.1.0
Back to Top
tralfaz View Drop Down
Groupie
Groupie


Joined: 21 June 2009
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote tralfaz Quote  Post ReplyReply Direct Link To This Post Posted: 10 July 2009 at 3:38pm
still waiting for support to get back to me. Is it possible to create a MenuBar from an existing CMenu? Or can I get ahold of a CMenu submenu from a MenuBar?

XP Pro SP3 / VS2008 C++ / Xtreme CommandBars v13.1.0
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: 13 July 2009 at 2:21am
After you converted Menu to CXTPMenuBar you have use methods of CXTPControl/CXTPControls to modify/add items:
 
pMenuBar->GetControl(1)->SetCaption("New Caption");
etc.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
tralfaz View Drop Down
Groupie
Groupie


Joined: 21 June 2009
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote tralfaz Quote  Post ReplyReply Direct Link To This Post Posted: 23 July 2009 at 1:00am
Oleg - your answer leaves a lot to be desired. How am I to create a submenu using GetControl? Seems extremely laborious. Can you elaborate a little?


XP Pro SP3 / VS2008 C++ / Xtreme CommandBars v13.1.0
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: 24 July 2009 at 3:28am

Hi,

See CXTPControls methods - you need "Add" one:
 
pMenuBar->GetControls()->Add(xtpControlPopup, ...);
 
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.156 seconds.