Menu in dialogs!
-
Hi, How to make command UI fuctions like; pCmdUI->SetText, pCmdUI->Enable, pCmdUI->SetCheck to work when we have a menu in dialog? Currently it works for menus in SDI/MDI's but not in dialogs :confused:
-
Hi, How to make command UI fuctions like; pCmdUI->SetText, pCmdUI->Enable, pCmdUI->SetCheck to work when we have a menu in dialog? Currently it works for menus in SDI/MDI's but not in dialogs :confused:
Manikandan wrote: How to make command UI fuctions like; pCmdUI->SetText, pCmdUI->Enable, pCmdUI->SetCheck to work when we have a menu in dialog? Currently it works for menus in SDI/MDI's but not in dialogs Check this post[^] -- jlr http://jlamas.blogspot.com/[^]
-
Manikandan wrote: How to make command UI fuctions like; pCmdUI->SetText, pCmdUI->Enable, pCmdUI->SetCheck to work when we have a menu in dialog? Currently it works for menus in SDI/MDI's but not in dialogs Check this post[^] -- jlr http://jlamas.blogspot.com/[^]
Thanks Jose. I also found a easy way to do this something as below, // Get the popup menu which contains the "Lock" menu item. CMenu* mmenu = GetMenu(); CMenu* submenu = mmenu->GetSubMenu(2); submenu->CheckMenuItem(ID_LOCK, (m_bLock)?MF_CHECKED : MF_UNCHECKED | MF_BYCOMMAND); ;P
-
Thanks Jose. I also found a easy way to do this something as below, // Get the popup menu which contains the "Lock" menu item. CMenu* mmenu = GetMenu(); CMenu* submenu = mmenu->GetSubMenu(2); submenu->CheckMenuItem(ID_LOCK, (m_bLock)?MF_CHECKED : MF_UNCHECKED | MF_BYCOMMAND); ;P
Well, that's a different approach. It means that whenever (and wherever) you change m_bLock, you have to get to the menu item and change it. The other approach goes the other way, whenever the menu needs to be shown (and only then), you get the chance to alter its state (enable, check, text, etc.). Besides, it's a general mechanism you can use for any menu item. But I agree that, if that's the only menu item you need to change and if m_bLock is only changed in a single place, your method is simpler :) -- jlr http://jlamas.blogspot.com/[^]