Re: Delphi: make function keys to be shortcuts

Posted by Martin Jackson on February 01, 2000

In Reply to: make function keys to be shortcuts posted by Djordje on February 01, 2000

You need to set the keypreview property of the buttons form to true, and then put some code in the onKeyDown event of the form which reads as follows:
if Key = VK_F1 then 
   btnTestclick(Self);

The VK_F1 is a constant. You could also use VK_F2, VK_F3 etc. All this code does is call the code behind the onClick event of the button.

Hope this helps.
Martin Jackson


Find related articles:

    OnKeypress / TEdit
    Make ENTER key function as TAB
    Disable ALT-F4 key combination
    Keypress in console application