Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to Check/ Uncheck menu item

How to Check/ Uncheck menu item

Scheduled Pinned Locked Moved C / C++ / MFC
designtutorialquestionannouncement
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hachaso
    wrote on last edited by
    #1

    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??

    R H 2 Replies Last reply
    0
    • H Hachaso

      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??

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      Hachaso wrote: pCmdUI->m_pSubMenu->CheckMenuItem(ID_HELP_CHECKTHIS, MF_CHECKED); What value does this return ? ~RaGE();

      1 Reply Last reply
      0
      • H Hachaso

        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??

        H Offline
        H Offline
        hatemtaleb
        wrote on last edited by
        #3

        use pCmdUI->SetCheck(); instead of pCmdUI->m_pSubMenu->CheckMenuItem(ID_HELP_CHECKTHIS, MF_CHECKED);

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups