From CWnd to CFrameWnd: menu items appear disabled!
-
Hi, I rewrote my main window (originally derived from CWnd) as an object derived from CFrameWnd. How come that all my menu items appear as disabled now?? I can't make any selection! Same with my pop-up menu. I create my menu in the exact same way as before: CMenu myMenu; myMenu.LoadMenu(IDR_MAIN_MENU); SetMenu(&myMenu); myMenu.Detach(); Only sub-menus appear as enabled. Also when the command ID for an item is set to 0, it appears as enabled... Any idea what went wrong? Thanks :)
-
Hi, I rewrote my main window (originally derived from CWnd) as an object derived from CFrameWnd. How come that all my menu items appear as disabled now?? I can't make any selection! Same with my pop-up menu. I create my menu in the exact same way as before: CMenu myMenu; myMenu.LoadMenu(IDR_MAIN_MENU); SetMenu(&myMenu); myMenu.Detach(); Only sub-menus appear as enabled. Also when the command ID for an item is set to 0, it appears as enabled... Any idea what went wrong? Thanks :)
I finally got it to work, but I don't really understand it: I now intercept the WM_INITMENUPOPUP-message and simply return 0. By doing so the menus appear as enabled! How come I have to do this? (I didn't do it in my message loop of my CWnd-window I had first and the menus didn't appear as disabled)
-
Hi, I rewrote my main window (originally derived from CWnd) as an object derived from CFrameWnd. How come that all my menu items appear as disabled now?? I can't make any selection! Same with my pop-up menu. I create my menu in the exact same way as before: CMenu myMenu; myMenu.LoadMenu(IDR_MAIN_MENU); SetMenu(&myMenu); myMenu.Detach(); Only sub-menus appear as enabled. Also when the command ID for an item is set to 0, it appears as enabled... Any idea what went wrong? Thanks :)
A feature of MFC is that any toolbar buttons and menu items that don't yet have a handler get disabled. You can turn this off by setting
CFrameWnd::m_bAutoMenuEnable
toFALSE
in your CMainFrame constructor. --Mike-- When 900 years old you reach, look as good you will not. Hmm. 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm