![]() |
CXTPMenuBar - need pointer to CMenu |
Post Reply
|
| Author | |
tralfaz
Groupie
Joined: 21 June 2009 Status: Offline Points: 36 |
Post Options
Thanks(0)
Quote Reply
Topic: CXTPMenuBar - need pointer to CMenuPosted: 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 |
|
![]() |
|
rdhd
Senior Member
Joined: 13 August 2007 Location: United States Status: Offline Points: 951 |
Post Options
Thanks(0)
Quote Reply
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).
|
|
![]() |
|
tralfaz
Groupie
Joined: 21 June 2009 Status: Offline Points: 36 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
tralfaz
Groupie
Joined: 21 June 2009 Status: Offline Points: 36 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
tralfaz
Groupie
Joined: 21 June 2009 Status: Offline Points: 36 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
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 |