Click to See Complete Forum and Search --> : Menu Question


Wilka
April 12th, 1999, 06:58 AM
How can grey or hide a menu itemt hat has a sub menu at runtime? When a menu is set as pop-up (so that it has a submenu) the id combo box gets disabled.

April 12th, 1999, 07:38 AM
Use the MF_BYPOSITION flag when calling EnableMenuItem. See the following code fragment.

void CMainFrame::OnInitMenu(CMenu* pMenu)
{
CMDIFrameWnd::OnInitMenu(pMenu);
CMenu* pSubMenu=pMenu->GetSubMenu(2);
pSubMenu->EnableMenuItem(0,MF_BYPOSITION|MF_GRAYED);
}