![]() |
Function keys onFormKeyDown
Hi,
I would like to use the function key (F1) in my application. I was trying several times to make it work in the following way
Code:
it was not working then i fount that, if i make the "KeyPreview := True" then then it works
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState); if Key = VK_F1 then //do something here though i have read about it from several sites, neverthless i am not totally clear and therefore i need a suggestion, is that okay if i make "KeyPreview := True" or it can be affected other event handlers? and should i need to make the Key := 0 at the end? like the follwoing way
Code:
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState); if Key = VK_F1 then //do something here Key := 0 // i mean here should i make it Key is zero |
AW: Function keys onFormKeyDown
I've never tried it myself, but
![]() Zitat:
Delphi-Quellcode:
in your
Key := 0
Delphi-Quellcode:
, then the component that is currently selected won't even notice a key way pressed. If you want it do to some additional stuff, then don't zero it out :-)
TForm1.FormKeyDown
So KeyPreview itself does not affect other handlers, while setting Key to zero does. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:18 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz