|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Nilesh Yeolekar
|
Jun 5, 2007 - 5:33 AM
|
I have a code like CMenu tempCmenu; tempCmenu.CreatePopupMenu(); //after this I m creating different popups depending on criteria
then, I use somethinkg like this...
CMenu* pMenu = pFrameWnd->m_wndMenuBar.GetMenu(); //here m_wndMenuBar is of CExtMenuControlBar. I m creating menubar with wndMenuBar.Create()
pMenu->InsertMenu(nPos, MF_POPUP | MF_BYPOSITION, (UINT)tempCmenu.Detach(), strMenuTitle);
Now, I want to use CExtPopupMenuWnd instead of CMenu to update the main menu and to redraw it so that I can insert one popup menu in the main menu bar
How do I do it?
Thanks Nilesh ------------
|
|
Technical Support
|
Jun 5, 2007 - 10:43 AM
|
You can modify the CMenu object returned by CExtMenuControlBar::GetMenu() only if your application is SDI because MDI applications constantly reset this menu. Finally, you should invoke the CExtMenuControlBar::UpdateMenuBar() method to see the changes.
|
|
Nilesh Yeolekar
|
Jun 6, 2007 - 4:11 AM
|
We have a legacy application which uses CMenu to insert menu in the main menu. code is like below
CMenu tempMenu; tempMenu.CreatePopupMenu(); pObj->OnSelect(vBRSUserObj,&tempMenu);
//here we use AppendMenu to create various popup menus depending on the criteria.
then we use CMenu* pMenu = AfxGetApp()->GetMainWnd()->GetMenu();
pMenu->InsertMenu(nPos, MF_POPUP | MF_BYPOSITION, (UINT)tempMenu.Detach(), strMenuTitle);
//tempMenu.Detach() returns a handle of popup menus created above so the main menu will have all the popups appended to it.
then we use AfxGetApp()->GetMainWnd()->DrawMenuBar();
Now, we replaced our main menu with CExtMenuControlBar(m_wndMenuBar).
Now we use
CMenu tempCmenu; CExtPopupMenuWnd * tempMenu = new CExtPopupMenuWnd(); tempCmenu.CreatePopupMenu(); tempMenu->UpdateFromMenu(GetSafeHwnd(), &tempCmenu);
Is this a correct way to do this?
//then we use, CExtPopupMenuWnd pointer tempMenu to create various popup menus like
pObj->OnSelect(vBRSUserObj,tempMenu);
//here we create popup menus like for (i to n) { tempMenu->ItemInsertCommand(id, -1, sometext); }
Now how can I use the created popup menus (ceated from CExtPopupMenuWnd pointer tempMenu) to get appended in the main menu(which is of type CExtMenuControlBar?
How can I insert a menu(a popup menu created with CExtPopupMenuWnd) in a CExtMenuControlBar?
|
|
Technical Support
|
Jun 6, 2007 - 8:28 AM
|
|
|