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