how do you disable menu command?
-
hi everyonebody, i have a popup menu, activated by right click.. i want to disable some of the commands in the menu.. i was wondering how do i do it? i've different ways, but i can't seem to get it working.. any suggestion is welcome.. thanx in advance. i've tried this: void CMyApp::OnRMrclk(....) { CMenu menu; CPoint point = GetMessagePos(); menu.LoadMenu(IDR_MENU1); menu.EnableMenuItem(ID_MENU1_ONE, MF_GRAYED); menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, AfxGetMainWnd()); } i've also tried this: void CMyApp::OnUpdateMenu1One(CCmdUI *pCmdUI) { CMenu * pMenu = pCmdUI->m_pMenu; pMenu->EnableMenuItem(ID_MENU1_ONE, MF_GRAYED); }
-
hi everyonebody, i have a popup menu, activated by right click.. i want to disable some of the commands in the menu.. i was wondering how do i do it? i've different ways, but i can't seem to get it working.. any suggestion is welcome.. thanx in advance. i've tried this: void CMyApp::OnRMrclk(....) { CMenu menu; CPoint point = GetMessagePos(); menu.LoadMenu(IDR_MENU1); menu.EnableMenuItem(ID_MENU1_ONE, MF_GRAYED); menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, AfxGetMainWnd()); } i've also tried this: void CMyApp::OnUpdateMenu1One(CCmdUI *pCmdUI) { CMenu * pMenu = pCmdUI->m_pMenu; pMenu->EnableMenuItem(ID_MENU1_ONE, MF_GRAYED); }
See the VC forum FAQ, In my MFC program, I'm trying to disable a menu item with EnableMenuItem(), but it doesn't have any effect on the menu. Why? The correct code for the update command UI handler is
{
pCmdUI->Enable(FALSE);
}--Mike-- If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape. 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm