Mega Code Archive

 
Categories / Delphi / Examples
 

How to find the appropriate constant for virtual keys

Title: How to find the appropriate constant for virtual keys procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = (*Keyboard Code*) then ShowMessage('OnKeyDown'); //Or other thing end; { Es geht auch mit OnKeyPress (dort funktionieren aber nicht alle Keyboard Codes): Or trap a Key in the OnKeyPress event (note that not all Keyboard Codes work there} procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char); begin if (Key = chr(vk_Return)) then ShowMessage('OnKeyPress'); end;