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. Change menu item text

Change menu item text

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

    It is possible to change the text of an menu item who has another branch menu ? I have tried classical solution:

    pCmdUI->SetText(_T("&aaaa"));

    but is working only on simple menu item ... if from this menu item go another menu items branch, the text have not change it ...

    L 1 Reply Last reply
    0
    • _ _Flaviu

      It is possible to change the text of an menu item who has another branch menu ? I have tried classical solution:

      pCmdUI->SetText(_T("&aaaa"));

      but is working only on simple menu item ... if from this menu item go another menu items branch, the text have not change it ...

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      It should work, but if you have a resource based menu it's possible the system is refreshing it from your resource details.

      _ 1 Reply Last reply
      0
      • L Lost User

        It should work, but if you have a resource based menu it's possible the system is refreshing it from your resource details.

        _ Offline
        _ Offline
        _Flaviu
        wrote on last edited by
        #3

        I put a TRACE macro inside of ON_UPDATE_COMMAND_UI handler, but strange, it doesn't call at all ... that is why the text is not changing ... this message (ON_UPDATE_COMMAND_UI) is not calling for menu items that has derived menu from itself ?

        L 1 Reply Last reply
        0
        • _ _Flaviu

          I put a TRACE macro inside of ON_UPDATE_COMMAND_UI handler, but strange, it doesn't call at all ... that is why the text is not changing ... this message (ON_UPDATE_COMMAND_UI) is not calling for menu items that has derived menu from itself ?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Did you add their control ids to the set that the ON_UPDATE_COMMAND_UI responds to?

          _ 1 Reply Last reply
          0
          • L Lost User

            Did you add their control ids to the set that the ON_UPDATE_COMMAND_UI responds to?

            _ Offline
            _ Offline
            _Flaviu
            wrote on last edited by
            #5

            Yes, I did:

            ON_UPDATE_COMMAND_UI(ID_VIEW_RENDERER1PLAN, &CMyAppDoc::OnUpdateViewRenderer1plan)

            The fact is when I change menu item functionality, from this state (when from this menu is derived another menu item) into simple menu item, the text changing is working ...

            L 1 Reply Last reply
            0
            • _ _Flaviu

              Yes, I did:

              ON_UPDATE_COMMAND_UI(ID_VIEW_RENDERER1PLAN, &CMyAppDoc::OnUpdateViewRenderer1plan)

              The fact is when I change menu item functionality, from this state (when from this menu is derived another menu item) into simple menu item, the text changing is working ...

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              It is difficult to guess what may be happening in your code, but changing the text of a control should have no effect on the message passing and event handling for that control. I would try it myself but do not have MFC on my system. There is also some useful information at https://msdn.microsoft.com/en-us/library/65dtx4a4.aspx[^].

              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