...find the appropriate constant for virtual keys?
Author: Home-Building (Christian)
// Keyboard Codes:
// Useful If you don't have the Source-Code from Windows.pas
// Nützlich, wenn man den Source-Code von der Windows Unit nicht hat.
vk_LButton
vk_RButton
vk_Cancel
vk_MButton
vk_Back
vk_Tab
vk_Clear
vk_Return
vk_Shift
vk_Control
vk_Menu
vk_Pause
vk_Capital
vk_Escape
vk_Space
vk_Prior
vk_Next
vk_Home
vk_Left
vk_Up
vk_Right
vk_Down
vk_Select
vk_Print
vk_Execute
vk_SnapShot
vk_Insert
vk_Delete
vk_Help
vk_NumPad0 vk_NumPad1 vk_NumPad2 vk_NumPad3
vk_NumPad4 vk_NumPad5 vk_NumPad6 vk_NumPad7
vk_NumPad8 vk_NumPad9
vk_Multiply
vk_Add
vk_Separator
vk_Subtract
vk_Decimal
vk_Divide
vk_F1 vk_F2 vk_F3 vk_F4 vk_F5 vk_F6 vk_F7 vk_F8
vk_F9 vk_F10 vk_F11 vk_F12 vk_F13 vk_F14 vk_F15
vk_F16 vk_F17 vk_F18 vk_F19 vk_F20 vk_F21 vk_F22
vk_F23 vk_F24
vk_NumLock
vk_Scroll
// OnKeyDown fires when the user presses a key.
// Das Ereignis OnKeyDown wird ausgelöst, wenn der Benutzer eine Taste drückt.
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;
printed from
www.swissdelphicenter.ch
developers knowledge base