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#
  4. How does the menu update the status bar?

How does the menu update the status bar?

Scheduled Pinned Locked Moved C#
csharpquestionannouncement
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.
  • Z Offline
    Z Offline
    Zombies with Coffee LLC
    wrote on last edited by
    #1

    Use your mouse to go over any menu item on any program. The status bar updates automatically with a description that you've added. How do you do it with C#? Thanks!!

    D 1 Reply Last reply
    0
    • Z Zombies with Coffee LLC

      Use your mouse to go over any menu item on any program. The status bar updates automatically with a description that you've added. How do you do it with C#? Thanks!!

      D Offline
      D Offline
      David Wengier
      wrote on last edited by
      #2

      Handle the Select event of the MenuItem and just set the status bar text (or anything else) as you wish. -- David Wengier Sonork ID: 100.14177 - Ch00k

      Z 1 Reply Last reply
      0
      • D David Wengier

        Handle the Select event of the MenuItem and just set the status bar text (or anything else) as you wish. -- David Wengier Sonork ID: 100.14177 - Ch00k

        Z Offline
        Z Offline
        Zombies with Coffee LLC
        wrote on last edited by
        #3

        Yep, that definitely helps. Is there any way of doing it automatically (as I'm used to in MFC)? Or do I have to make one gigantic 'if' statement with the text that I want to display?

        D 1 Reply Last reply
        0
        • Z Zombies with Coffee LLC

          Yep, that definitely helps. Is there any way of doing it automatically (as I'm used to in MFC)? Or do I have to make one gigantic 'if' statement with the text that I want to display?

          D Offline
          D Offline
          David Wengier
          wrote on last edited by
          #4

          I dont know about doing it automatically, but you could always create your own derived MenuItem class, or an ExtenderProvider that would do it. -- David Wengier Sonork ID: 100.14177 - Ch00k

          Z 1 Reply Last reply
          0
          • D David Wengier

            I dont know about doing it automatically, but you could always create your own derived MenuItem class, or an ExtenderProvider that would do it. -- David Wengier Sonork ID: 100.14177 - Ch00k

            Z Offline
            Z Offline
            Zombies with Coffee LLC
            wrote on last edited by
            #5

            True, I saw some examples in Petzold. But then wouldn't you loose the capability of using the IDE to create your menus? I currently have the following code snippet for the display on the status bar. private void MenuLoad_Select(object sender, System.EventArgs e) { MenuItem oMenuItem = sender as MenuItem; if( oMenuItem != null ) { switch( oMenuItem.Text ) { case "&Open": StatusBarMessage.Text = "Open up the file"; break; case "&Save": StatusBarMessage.Text = "Save the file to the disk"; break; } } }

            D 1 Reply Last reply
            0
            • Z Zombies with Coffee LLC

              True, I saw some examples in Petzold. But then wouldn't you loose the capability of using the IDE to create your menus? I currently have the following code snippet for the display on the status bar. private void MenuLoad_Select(object sender, System.EventArgs e) { MenuItem oMenuItem = sender as MenuItem; if( oMenuItem != null ) { switch( oMenuItem.Text ) { case "&Open": StatusBarMessage.Text = "Open up the file"; break; case "&Save": StatusBarMessage.Text = "Save the file to the disk"; break; } } }

              D Offline
              D Offline
              David Wengier
              wrote on last edited by
              #6

              If you are overriding the menus but not any of the drawing code (DrawItem and MeasureItem) then I would guess that the IDE should handle it, but I dont know. Try it and find out. An extender provider would certainly not affect the IDE. Probably the easiest way to do this would just be to buildup a collection of messages. This saves the interface, but doesnt allow you to set the menu help text in the forms designer. -- David Wengier Sonork ID: 100.14177 - Ch00k

              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