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. ATL / WTL / STL
  4. WTL Menu problem

WTL Menu problem

Scheduled Pinned Locked Moved ATL / WTL / STL
helpc++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.
  • D Offline
    D Offline
    damir_tk
    wrote on last edited by
    #1

    Hi everybody, I have a problem with a menu on a regular dialog. I want to change the text of the menu item in run-time, so I do this: ModifyMenu( GetMenu(), 0, MF_STRING | MF_BYPOSITION, 0, (LPCTSTR) _T( "View" ) ); This works if the menu is submenu and I am changing the items there, but if I want to change the root menu (the one that sits on the menu bar and does not have an ID), then it changes but it does not display any changes until I move the mouse over it, so I guess it does not refreshes immediatelly. Or maybe there is a whole better way to change the text of the menu items at runtime? I went through Michael Dunn's articles, but only have seen the examples of toolbar and statusbar, with UISetText, but this does not work in my case. Thanks for your help in advance.

    M 1 Reply Last reply
    0
    • D damir_tk

      Hi everybody, I have a problem with a menu on a regular dialog. I want to change the text of the menu item in run-time, so I do this: ModifyMenu( GetMenu(), 0, MF_STRING | MF_BYPOSITION, 0, (LPCTSTR) _T( "View" ) ); This works if the menu is submenu and I am changing the items there, but if I want to change the root menu (the one that sits on the menu bar and does not have an ID), then it changes but it does not display any changes until I move the mouse over it, so I guess it does not refreshes immediatelly. Or maybe there is a whole better way to change the text of the menu items at runtime? I went through Michael Dunn's articles, but only have seen the examples of toolbar and statusbar, with UISetText, but this does not work in my case. Thanks for your help in advance.

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      You need to call DrawMenuBar() to redraw the menu.

      --Mike-- Visual C++ MVP :cool: LINKS~! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ "That's what's great about doing user interface work. No matter what you do, people will say that what you did was idiotic." -- Raymond Chen

      D 2 Replies Last reply
      0
      • M Michael Dunn

        You need to call DrawMenuBar() to redraw the menu.

        --Mike-- Visual C++ MVP :cool: LINKS~! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ "That's what's great about doing user interface work. No matter what you do, people will say that what you did was idiotic." -- Raymond Chen

        D Offline
        D Offline
        damir_tk
        wrote on last edited by
        #3

        Exactly! Thanks for your help, I really appreciate it.

        1 Reply Last reply
        0
        • M Michael Dunn

          You need to call DrawMenuBar() to redraw the menu.

          --Mike-- Visual C++ MVP :cool: LINKS~! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ "That's what's great about doing user interface work. No matter what you do, people will say that what you did was idiotic." -- Raymond Chen

          D Offline
          D Offline
          damir_tk
          wrote on last edited by
          #4

          The problem still persists in some way. After I call DrawMenuBar(), it does refreshes the menu but now the code that checks and unchecks the menu item does not work at all. Also, the code that grays out some menu item does not work either, and it doesn't matter how many times I call DrawMenuBar(). I am not sure whether this behavior is specific to DrawMenuBar(), or is caused by the ModifyMenu command, but it sure screws up the app. Thank you.

          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