Mega Code Archive

 
Categories / Delphi / Functions
 

Arrow and Function Keys

Title: Arrow and Function Keys Question: How can I trap the Arrow and Function Keys? Answer: Check for the correct virtual key in the KeyDown event for the form. Example: procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = VK_RIGHT then Form1.Caption := 'Right'; if Key = VK_F1 then Form1.Caption := 'F1'; end;