Board index » delphi » how do I use Hot Keys
QBD The Bookshop
![]() Delphi Developer |
Sat, 23 Nov 2002 03:00:00 GMT
|
QBD The Bookshop
![]() Delphi Developer |
Sat, 23 Nov 2002 03:00:00 GMT
how do I use Hot Keys
Hi All,
I want to use the F4 from the TEdit Component so I use when key presssed use thanks for anyone who can help Aaron |
Bob Brow
![]() Delphi Developer |
Sat, 23 Nov 2002 03:00:00 GMT
Re:how do I use Hot KeysHi Aaron, you're almost there .... The following code will put the text "<F4>" on the end of the current text procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; Of course, if you want to fire off a procedure instead, just replace the Also, bear in mind that if the Form's KeyPreview property is set to True procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; This will apply to all TEdit controls on the form. Just remember to set the Hope this helps, - Bob - QBD The Bookshop <supp...@qbdthebookshop.com.au> wrote in message Quote> Hi All, |
M.H. Avegaar
![]() Delphi Developer |
Sat, 23 Nov 2002 03:00:00 GMT
Re:how do I use Hot KeysThe examples forget to set Key := 0 if the key is processed (otherwise F4 would still be processed, provided it had a function). procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; Shift: procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: "Bob Brown" <bob.br...@opus.co.nz> schreef in bericht Quote> Hi Aaron, you're almost there .... |
Bob Brow
![]() Delphi Developer |
Sun, 24 Nov 2002 03:00:00 GMT
Re:how do I use Hot KeysY'know I thought of that at the time but then forgot all about it! :) Lets have a bit of fun with this routine ... Something else that is a neat trick is getting the hotkey text to be procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; const begin if Key=HotKey then { We can't work directly on Edit1.text so put it in a string var } { If there's text selected, delete it - this is standard windows { Insert the HotText - see const above. } { Put it back in Edit1.Text } { Move the insert point... } { "Nullify" the keystroke and we're done! } Try that on and see what happens. Notice that I have qualified the Insert Cheers, - Bob - QuoteM.H. Avegaart <avega...@NOSPAMmccomm.nl> wrote in message Quote> The examples forget to set Key := 0 if the key is processed (otherwise F4 |
1. Single key vs Alt+key hot keys under Delphi 5
2. Trapping hot key presses using TOutline control
3. Standard for function-keys and hot-keys?
4. Hot keys
5. D4: Hot Keys Are Being Keyboard Buffered?
6. GLOBAL HOT KEY - HELP NEEDED
7. Hot to catch the [Enter] key??
8. How to set Hot Keys (system wide)