Author: Tomas Rutkauskas
How to trap your own hot keys
Windows has many default hot keys that your interface takes advantage of. However,
you sometimes need to add your own hot keys to your form. How do you trap the hot
keys when the user enters them?
To solve this problem, first set your form KeyPreview property to True. Next, add
this line of code to your form's OnKeyDown event handler:
1 2 if (ssCtrl in Shift) and (chr(Key) in ['A', 'a']) then3 ShowMessage('Ctrl-A');
The OnKeyDown event will trap the keystrokes and perform the specified code in response.