Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Switching MDI Menus from simple to advanced
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Switching MDI Menus from simple to advanced

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


Joined: 06 June 2007
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dexter Quote  Post ReplyReply Direct Link To This Post Topic: Switching MDI Menus from simple to advanced
    Posted: 14 February 2008 at 9:27pm
I am just finishing an MDI application that has two document templates, each with a separate menu. All works well, in fact extremely well.
But the menus are quite large and I would like to have a simple menu for each of the document templates which would be loaded at the begining but that users could change at any time.

I does not matter that any changes to the menus would be lost, in fact I prefer that if the user changes from simple to advanced mode they start fresh.

I have tried all sorts of things but can't seem to get it to work. The closest seemed to be using CXTPMenuBar::SwitchMDIMenu() as in the simplified code below from the CMainFrame class:

   if ( bSimpleMode ) {
      uMenu = IDR_DOC_DYNAMIC_SIMPLE;
      uMenu = IDR_DOC_STATIC_SIMPLE;
   } else {
      uMenu = IDR_DOC_DYNAMIC; // this is the id of the first template
      uMenu = IDR_DOC_STATIC; // this is the id of the second template
   }

   cMenu.LoadMenu( MIR( uMenu ) );
   CXTPCommandBars* pCommandBars =  GetCommandBars();
   pMenuBar = (CXTPMenuBar *)pCommandBars->GetMenuBar();
   pMenuBar->SwitchMDIMenu( IDR_DOC_DYNAMIC, &cMenu );

and afterwards I tried various ways to redraw the command bars and window but all to no effect.

Any suggestions on how this could be done would be greatly appreciated!

Thanks,
Dexter of FileBoss

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: 15 February 2008 at 1:41am
Hi,
 
If you don't need keep user customization for menus you can just call
 
pMenuBar->LoadMenu(&cMenu);
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Dexter View Drop Down
Newbie
Newbie


Joined: 06 June 2007
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dexter Quote  Post ReplyReply Direct Link To This Post Posted: 15 February 2008 at 2:11am
Originally posted by oleg oleg wrote:

If you don't need keep user customization for menus you can just call 
 pMenuBar->LoadMenu(&cMenu);


Thanks! Though it does make me feel a little strange as I tried so many different calls, both MFC and in the toolkit but not that one.

It certainly works but still leaves one problem. It will only change the menu for the document template of the current view and child frame. But I have two document templates that need to be changed, i.e. both templates should have either simple or advanced menus not one simple and the other advanced.

If I have to I could set a flag so that the next time a frame belonging to the other document template is activated it would make the appropriate call to CXTPMenuBar::LoadMenu().

But if there is a way to set the menus for both document templates immediately that would certainly be much better.

Thanks,
Dexter
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.141 seconds.