Switching MDI Menus from simple to advanced |
Post Reply |
Author | |
Dexter
Newbie Joined: 06 June 2007 Status: Offline Points: 3 |
Post Options
Thanks(0)
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 |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
If you don't need keep user customization for menus you can just call
pMenuBar->LoadMenu(&cMenu);
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Dexter
Newbie Joined: 06 June 2007 Status: Offline Points: 3 |
Post Options
Thanks(0)
|
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 |
|
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 |