Creating Sub (sub) menus dynamically at run time
- From: jtfaulk@xxxxxxxxxxxxxx
- Date: 5 Oct 2005 09:49:36 -0700
I'm trying to create/modify my menu at run-time. I can modify the menu
to one level deep easily enough, as follows:
// 1. VIEW MENU (CHANGE DEPENDING ON AUTOCAD OR LEAD)
// 1.1 Get the menu from the application window.
CMenu* mmenu = m_pApp.m_MainFrame->GetMenu();
// 1.2 Look for "OVERLAY" menu.
int pos = FindMenuItem(mmenu, "Overlay");
if (pos == -1) return;
CMenu *submenu = mmenu->GetSubMenu(pos);
// 1.3 Delete Current Menu Items
for (int i=submenu->GetMenuItemCount();i>=0;--i)
submenu->DeleteMenu(i, MF_BYPOSITION);
pos = 0;
submenu->InsertMenu(pos, MF_BYPOSITION, ID_OVERLAY_ROTATE45CW, "Rotate
45° CCW" );
submenu->InsertMenu(pos+1, MF_BYPOSITION, ID_OVERLAY_ROTATE45CW,
"Rotate 45° CW" );
etc.
This works fine. But what I need to do is make a menu/submenu/submenu.
Like:
File Edit Overlay
Rotate ->
sub menu item 1 (THIS IS WHAT I CANNOT FIGURE
OUT)
sub menu item 2
Other menu item 1
Other menu item 2
Does any body have any ideas? Thank you,
.
- Follow-Ups:
- Prev by Date: Adding a control variable
- Next by Date: Button flicker in views
- Previous by thread: Adding a control variable
- Next by thread: Re: Creating Sub (sub) menus dynamically at run time
- Index(es):