How does the menu update the status bar?
-
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!!
-
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!!
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
-
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
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?
-
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?
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
-
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
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; } } }
-
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; } } }
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