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. Menu Modification Question

Menu Modification Question

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 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.
  • S Offline
    S Offline
    Scorp1us
    wrote on last edited by
    #1

    Ok, I know I am supposed to use ON_UPDATE_COMMAND_UI handlers for each menu item, but is there a way to do it for allof them from one function? I have a ton of these to go through if that is the case! (I just want to enable-disable them) Thanks

    C 1 Reply Last reply
    0
    • S Scorp1us

      Ok, I know I am supposed to use ON_UPDATE_COMMAND_UI handlers for each menu item, but is there a way to do it for allof them from one function? I have a ton of these to go through if that is the case! (I just want to enable-disable them) Thanks

      C Offline
      C Offline
      Chris Richardson
      wrote on last edited by
      #2

      Yeah, just hook all the IDs up to the same function (i.e., when ClassWizard supplies you with a function name, just change it to be like OnUpdateAllMenuItems, and do this for every menu item you want to enable/disable at the same time). Chris Richardson C/C++ Include Finder[^]

      S 1 Reply Last reply
      0
      • C Chris Richardson

        Yeah, just hook all the IDs up to the same function (i.e., when ClassWizard supplies you with a function name, just change it to be like OnUpdateAllMenuItems, and do this for every menu item you want to enable/disable at the same time). Chris Richardson C/C++ Include Finder[^]

        S Offline
        S Offline
        Scorp1us
        wrote on last edited by
        #3

        Thank you. I got it all working! Now I have a new problem.. When some of the top-level menues are disabled, then re-enabled some time later, they are not correnctly redrawn. They have the white from being diabled, and they aren't updated until the mouse is moved over them. How can I get the whole top-level menu redrawn? (File, Edit, etc.) Thanks again!

        C 1 Reply Last reply
        0
        • S Scorp1us

          Thank you. I got it all working! Now I have a new problem.. When some of the top-level menues are disabled, then re-enabled some time later, they are not correnctly redrawn. They have the white from being diabled, and they aren't updated until the mouse is moved over them. How can I get the whole top-level menu redrawn? (File, Edit, etc.) Thanks again!

          C Offline
          C Offline
          Chris Richardson
          wrote on last edited by
          #4

          Call the DrawMenuBar member of your CMainFrame class. If you are doing the enable/disable in a class other than CMainFrame, you can do this:

          AfxGetMainWnd()->DrawMenuBar();

          Chris Richardson C/C++ Include Finder[^]

          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