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. Re: Menu in dialog application, CheckMenuItem [modified]

Re: Menu in dialog application, CheckMenuItem [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
c++questionhelplearning
2 Posts 1 Posters 2 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.
  • M Offline
    M Offline
    mla154
    wrote on last edited by
    #1

    Dear all, I have created a dialog application using Visual C++ 2008 with a menu and I haven't been able to get a check mark to show on a menu item. In the class derived from CDialog, I declared a private member: CMenu m_menu; The menu IDR_MENU1 was loaded into the dialog using the resource editor. In the OnInitDialog function of the same class: m_menu.LoadMenuA(IDR_MENU1); When the user selects the menu item, the check should appear. The code reached after selecting the menu item: UINT j = m_menu.CheckMenuItem(ID_HELLO_CHOICE1, MF_BYCOMMAND | MF_CHECKED); The value of j is 0 after being executed the first time and 8 after being executed the second time, which is what I expected. However, I still see no check mark next to the menu item. How can I get the check mark to show? Any suggestions and help are appreciated. Regards, Mike -- Modified Friday, March 26, 2010 1:20 PM

    M 1 Reply Last reply
    0
    • M mla154

      Dear all, I have created a dialog application using Visual C++ 2008 with a menu and I haven't been able to get a check mark to show on a menu item. In the class derived from CDialog, I declared a private member: CMenu m_menu; The menu IDR_MENU1 was loaded into the dialog using the resource editor. In the OnInitDialog function of the same class: m_menu.LoadMenuA(IDR_MENU1); When the user selects the menu item, the check should appear. The code reached after selecting the menu item: UINT j = m_menu.CheckMenuItem(ID_HELLO_CHOICE1, MF_BYCOMMAND | MF_CHECKED); The value of j is 0 after being executed the first time and 8 after being executed the second time, which is what I expected. However, I still see no check mark next to the menu item. How can I get the check mark to show? Any suggestions and help are appreciated. Regards, Mike -- Modified Friday, March 26, 2010 1:20 PM

      M Offline
      M Offline
      mla154
      wrote on last edited by
      #2

      Dear all, I've just found an answer (funny how this happens just a few minutes after I post the question). In the class derived from CDialog, I changed m_menu to: CMenu *m_menu; In OnInitDialog, I replaced the LoadMenuA statement with: m_menu = GetMenu(); It worked! Regards, Mike

      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