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. Updating menu check marks

Updating menu check marks

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelpannouncement
2 Posts 2 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.
  • A Offline
    A Offline
    andyg 101
    wrote on last edited by
    #1

    Hope someone can help. I am trying to keep the check mark on my menu item updated. The menu item opens a modeless dialogue depending on the status of the member variable i.e. m_nCommsToggleState = m_nCommsToggleState == 0 ? 1 : 0; toggles this variable in the handler for the COMMAND_UI.(The handler then creates or destroys the modeless dialogue) message, and then the UPDATE_COMMAND_UI, calls the SetCheck member function turning on or off the check mark. The problem is that this works fine when I am turning the dialogue on and off with just the menu, but when I use say the close cross on the dialogue the check mark remains. How do I get the WM_CLOSE handler to call the Update function and clear the check mark? I am handling the UPDATE_COMMAND_UI message in my view class and the modeless dialogue has it's own class. I think I should be able to use the same message handler for updating the menu item wether the dialogue is closed using the cancel/cross button or the menu but i can't work out how from the docs. Sorry if this is a dumb question I'm quite a newbie! Thanks A

    R 1 Reply Last reply
    0
    • A andyg 101

      Hope someone can help. I am trying to keep the check mark on my menu item updated. The menu item opens a modeless dialogue depending on the status of the member variable i.e. m_nCommsToggleState = m_nCommsToggleState == 0 ? 1 : 0; toggles this variable in the handler for the COMMAND_UI.(The handler then creates or destroys the modeless dialogue) message, and then the UPDATE_COMMAND_UI, calls the SetCheck member function turning on or off the check mark. The problem is that this works fine when I am turning the dialogue on and off with just the menu, but when I use say the close cross on the dialogue the check mark remains. How do I get the WM_CLOSE handler to call the Update function and clear the check mark? I am handling the UPDATE_COMMAND_UI message in my view class and the modeless dialogue has it's own class. I think I should be able to use the same message handler for updating the menu item wether the dialogue is closed using the cancel/cross button or the menu but i can't work out how from the docs. Sorry if this is a dumb question I'm quite a newbie! Thanks A

      R Offline
      R Offline
      Ryan Binns
      wrote on last edited by
      #2

      All you need to do is update the value of m_nCommsToggleState. The UPDATE_COMMAND_UI handler should do the rest. If you try to remove the check mark without changing m_nCommsToggleState, the handler will put the check mark back again. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
      Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

      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