Keyboard Shortcuts without set focus

  • Thread starter Thread starter Mystique
  • Start date Start date
M

Mystique

How can i define keyboard shortcuts for a control, but if the control does
not have the focus set to it. I can do it if i define the text of the
control with the & sign, ex: &myText , but this way i can only use
alphabetic characters. How can use the arroy keyboard keys??
 
Hi Mistique,

What you are after in Win32 is called accelerator keys in .NET WindowsForms
is called shortcut.
Unlike Win32 where accelerator keys are not bound to any particular control
in WindowsForms they are bound to MenuItems only. If you want to set a
shortcut for a button for example you can create a special MenuItem in the
form's main menu with that shortcut and set its Visible property to false.
The menu item won't be shown but the shortcut will work. This solution is
given by Charles Petzold in his book "Programming Microsoft Windows with
C#".

About arrow keys as shortcuts I gave you my answer in your previous post
"Keyboard shortcuts" from March 19.
 

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

Back
Top