How to Check/ Uncheck menu item
-
Hi! I'm trying to add a menu to my dialog based program. In one of the submenus and submenuitem can be checked/unchecked. I don't know what I'm doing wrong but I can't make it to do this. No sign of it being checked appears. Here's the part where I think should do this but I don't know what to add. void CTestProgramForTestWATH2cppDlg::OnUpdateHelpCheckthis(CCmdUI *pCmdUI) { // TODO: Add your command update UI handler code here CWnd* pBar; if ((pBar = GetDlgItem(pCmdUI->m_nID)) == NULL) { pCmdUI->ContinueRouting(); return; // not for us } pCmdUI->m_pSubMenu->CheckMenuItem(ID_HELP_CHECKTHIS, MF_CHECKED); } BOOL CTestProgramForTestWATH2cppDlg::OnHelpCheckthis(UINT nID) { // TODO: Add your command handler code here return TRUE; } Does the function CheckMenuItem do what I request??
-
Hi! I'm trying to add a menu to my dialog based program. In one of the submenus and submenuitem can be checked/unchecked. I don't know what I'm doing wrong but I can't make it to do this. No sign of it being checked appears. Here's the part where I think should do this but I don't know what to add. void CTestProgramForTestWATH2cppDlg::OnUpdateHelpCheckthis(CCmdUI *pCmdUI) { // TODO: Add your command update UI handler code here CWnd* pBar; if ((pBar = GetDlgItem(pCmdUI->m_nID)) == NULL) { pCmdUI->ContinueRouting(); return; // not for us } pCmdUI->m_pSubMenu->CheckMenuItem(ID_HELP_CHECKTHIS, MF_CHECKED); } BOOL CTestProgramForTestWATH2cppDlg::OnHelpCheckthis(UINT nID) { // TODO: Add your command handler code here return TRUE; } Does the function CheckMenuItem do what I request??
-
Hi! I'm trying to add a menu to my dialog based program. In one of the submenus and submenuitem can be checked/unchecked. I don't know what I'm doing wrong but I can't make it to do this. No sign of it being checked appears. Here's the part where I think should do this but I don't know what to add. void CTestProgramForTestWATH2cppDlg::OnUpdateHelpCheckthis(CCmdUI *pCmdUI) { // TODO: Add your command update UI handler code here CWnd* pBar; if ((pBar = GetDlgItem(pCmdUI->m_nID)) == NULL) { pCmdUI->ContinueRouting(); return; // not for us } pCmdUI->m_pSubMenu->CheckMenuItem(ID_HELP_CHECKTHIS, MF_CHECKED); } BOOL CTestProgramForTestWATH2cppDlg::OnHelpCheckthis(UINT nID) { // TODO: Add your command handler code here return TRUE; } Does the function CheckMenuItem do what I request??
use pCmdUI->SetCheck(); instead of pCmdUI->m_pSubMenu->CheckMenuItem(ID_HELP_CHECKTHIS, MF_CHECKED);