hide submenu item on selecting a menu item
-
hi how do i disable a submenu item when i select another submenu item? thanks
-
hi how do i disable a submenu item when i select another submenu item? thanks
SEE the Sample code.............. :) Please modify the code as per your project. CMenu *mnuPop; mnuPop->LoadMenu(IDR_TASKBAR_MENU); SetForegroundWindow(); CWnd* pWnd = AfxGetMainWnd(); if(pWnd->IsIconic() != 0) // minimized { mnuPop->GetSubMenu(0)->EnableMenuItem(ID_WJRU_WJRU,MF_BYPOSITION | MF_ENABLED); } else { mnuPop->GetSubMenu(0)->EnableMenuItem(ID_WJRU_WJRU, MF_BYPOSITION | MF_GRAYED); }
-
SEE the Sample code.............. :) Please modify the code as per your project. CMenu *mnuPop; mnuPop->LoadMenu(IDR_TASKBAR_MENU); SetForegroundWindow(); CWnd* pWnd = AfxGetMainWnd(); if(pWnd->IsIconic() != 0) // minimized { mnuPop->GetSubMenu(0)->EnableMenuItem(ID_WJRU_WJRU,MF_BYPOSITION | MF_ENABLED); } else { mnuPop->GetSubMenu(0)->EnableMenuItem(ID_WJRU_WJRU, MF_BYPOSITION | MF_GRAYED); }
thanks for the help. but i am actually writing for a menu bar and when i click on a submenu item another submenuitem should get disabled. hope u're getting what i am trying to do.
-
hi how do i disable a submenu item when i select another submenu item? thanks
May be this will help you.. //This Code is Written in sub - submenu // Your First Menu. CMenu *mnuPop; // Your Second Menu. CMenu *mnuSubMenu; // Load your menu here... mnuPop->LoadMenu(IDR_THERMATYPE); // Get the Sub Menu handle handle here... mnuSubMenu = mnuPop->GetSubMenu(0); // Disable the Another Submenu from this Sub Menu... mnuSubMenu->EnableMenuItem(ID_EDIT_COPY,MF_BYPOSITION | MF_GRAYED); // Redraw your Menu after this.(only some times needed...
-
May be this will help you.. //This Code is Written in sub - submenu // Your First Menu. CMenu *mnuPop; // Your Second Menu. CMenu *mnuSubMenu; // Load your menu here... mnuPop->LoadMenu(IDR_THERMATYPE); // Get the Sub Menu handle handle here... mnuSubMenu = mnuPop->GetSubMenu(0); // Disable the Another Submenu from this Sub Menu... mnuSubMenu->EnableMenuItem(ID_EDIT_COPY,MF_BYPOSITION | MF_GRAYED); // Redraw your Menu after this.(only some times needed...
this gives an error in this line mnuSubMenu = mnuPop->GetSubMenu(0); i tried this out: CMenu popmenu; popmenu.EnableMenuItem(ID_CONFIGURE_UPDATE,MF_GRAYED); in the on click of the submenu item. but this gives a crash for me
-
this gives an error in this line mnuSubMenu = mnuPop->GetSubMenu(0); i tried this out: CMenu popmenu; popmenu.EnableMenuItem(ID_CONFIGURE_UPDATE,MF_GRAYED); in the on click of the submenu item. but this gives a crash for me
Is mnuPop valid and what return values of mnuSubMenu
WhiteSky
-
hi how do i disable a submenu item when i select another submenu item? thanks
Sunshine Always wrote:
how do i disable a submenu item when i select another submenu item?
you cannot hide/unhide teh menu item on runtime.. except if you creating menu on runtime.. you only can disable and enable the menu item
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you