SetMenu does not work ? |
Post Reply |
Author | |
coradinibr
Newbie Joined: 10 February 2004 Location: Brazil Status: Offline Points: 6 |
Post Options
Thanks(0)
Posted: 12 February 2004 at 2:19pm |
Hi, I need to change the menu based on the context of my application. I have tried to change it by the conventional way, but it doesn't work ! I did the following : 1) Create a static CMenu member in My CMDIChildWnd my class where I can load the menu resources that I want. 2) On the OnCreate function I load the resource menu and call SetMenu to change it.
// part of the code // s_menu is the static member ! menu.LoadMenu(IDR_MY_MENU_RESOURCE); // get the CommandBar created in the CMainFrame CXTPCommandBars* pCommandBar = theApp.m_pMainFrame->GetCommandBars(); // get the menu attached to it CXTPMenuBar* pMenuBar = pCommandBar->GetMenuBar(); // load the new menu pMenuBar->SetMenu(&menu);
I get no ASSERT or errors. The menu appears to load, but it appears on the border of the old menu. When I try to access the menu itens, the menu change to the old one. I'm using XTPro.
Thanks Evandro Coradini |
|
coradinibr
Newbie Joined: 10 February 2004 Location: Brazil Status: Offline Points: 6 |
Post Options
Thanks(0)
|
Hi, I figure out how to do it ! SetMenu does not work because it can be created only 1 time (the first time object is created). Simple example: CMenu menu; CXTPCommandBars* pCommandBar; Bye Evandro Coradini |
|
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 |