Board index » delphi » Function key as button 'hotkey'

Function key as button 'hotkey'

Hi,

I know how to set up a hotkey in a (bit)button through '&Caption'.
But how do I make the <F3> key the hotkey of a button?

Thanks
--
/-----------------------------------\
|Aad-Jan Couwenhoven                |
|Software Engineer BSS ProjectLine  |
|FoxPro v2.6x (Win/Dos/Mac)         |
|Delphi v1.0/v2.0                   |
|Clipper v5.2x                      |

Quote
>-----------------------------------<

| Carpe Diem, before anyone else    |
| does.                             |
|              ;-)                  |
\-----------------------------------/
 

Re:Function key as button 'hotkey'


Quote
Aad-Jan Couwenhoven <cou...@dm-visinescu.nl> wrote:
>Hi,

>I know how to set up a hotkey in a (bit)button through '&Caption'.
>But how do I make the <F3> key the hotkey of a button?

As far as I know, you can't. Instead, catch it in an OnKeyUp or
OnKeyDown event handler (possibly for the form, with KeyPreview:= true),
and call the button OnClick handler from there.

--
Best wishes

John Nurick

e-mail: j.nur...@dial.pipex.com
v-mail: <+44|0> 191 281 1306

Re:Function key as button 'hotkey'


For SpeedButtons it is easy to have a menu item which calls the same
click event as the speedbutton.  The menu item can have it's ShortCut
property set to the required function key.  I expect you don't want to
have this button on a menu but perhaps you can do a test to see if a
hidden menu item still acts upon it's ShortCut.  Worth a try.

John.

Other Threads