Einzelnen Beitrag anzeigen

question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#1

Function keys onFormKeyDown

  Alt 11. Sep 2013, 12:48
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:
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
 if Key = VK_F1 then
    //do something here
it was not working then i fount that, if i make the "KeyPreview := True" then then it works
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
  Mit Zitat antworten Zitat