How to disable menu shortcut keys

  • Thread starter Thread starter Amil Hanish
  • Start date Start date
A

Amil Hanish

I have shortcut keys to my menu in VS 2008 windows forms. I disable the
menu item when the menu is clicked; that works fine. But the user can still
press the shortcut key.

What is the PREFERRED way to handle shortcut keys and when pressed, check
them to verify they are valid. I was thinking of the KeyDown event in the
form.

amil
 
Amil Hanish said:
I have shortcut keys to my menu in VS 2008 windows forms. I disable the
menu item when the menu is clicked; that works fine. But the user can
still press the shortcut key.

What is the PREFERRED way to handle shortcut keys and when pressed, check
them to verify they are valid. I was thinking of the KeyDown event in the
form.

Handle the menu item's 'Click' event. Inside the 'Click' event handler you
can check if the menu item is enabled (the 'sender' parameter contains a
reference to the menu item the event belongs to).
 
Back
Top