MenuItem - Am I missing something obvious?

T

Terry

I've got a pretty standard menu at the top of my main form, and the
MenuItem's have event handlers for the "Select" event to update the
statusbar text, but what I can't seem to find is a way to know when the user
has cancelled the menu without clicking anything so I can clear the
statusbar text.

I feel like I'm missing something obvious. Does anyone know how to do this?

Thanks!
Terry
 
G

Guest

All your menu items (including the main menu) must use the same event handler
for the Select event. In the event handler you can put code similar to the
following code:

private void menuItem_Select(object sender, System.EventArgs e)
{
if (sender == menuItem2)
this.statusBar1.Panels[0].Text = "Menu 2";
else if (sender == menuItem3)
this.statusBar1.Panels[0].Text = "Menu 3";
else
this.statusBar1.Panels[0].Text = "Ready";
}

When the user cancels the menu the statusbar will show the text "Ready".

HTH, Jakob.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top