Shift is a collection variable.
Type TShiftState = set of (ssShift, ssAlt, ssCtrl, ssLeft, ssRight, ssMiddle, ssDouble);
That is to say, the TShiftstate type has ssShift, ssAlt, ssCtrl, ssLeft (left mouse button), ssRight (right mouse button), ssMiddle (mouse middle button), ssDouble (mouse double click)
Value Meaning
ssShift The Shift key is held down.
ssAlt The Alt key is held down.
ssCtrl The Ctrl key is held down.
ssLeft The left mouse button is held down.
ssRight The right mouse button is held down.
ssMiddle The middle mouse button is held down.
ssDouble The mouse was double-clicked.
Used to determine whether the combination key uses shift, Ctrl, left mouse button, right button, middle button, double click event.
Some common combination key values in Delphi
CTRL+A:#1 CTRL+B:#2 CTRL+C:#3 CTRL+D:#4 CTRL+E:#5 CTRL+F:#6 CTRL+G:#7
CTRL+H:#8 CTRL+I:#9 CTRL+J:#10 CTRL+K:#11 CTRL+L:#12 CR:#13 CTRL+N:#14
CTRL+O:#15 CTRL+P:#16 CTRL+Q:#17 CTRL+R:#18 CTRL+S:#19 CTRL+T:#20
CTRL+U:#21 CTRL+V:#22 CTRL+W:#23 CTRL+X:#24 CTRL+Y:#25 CTRL+Z:#26 ESC:#27
CTRL+:#28 CTRL+]:#29 SHIFT+CTRL+-:#30 DEL:#127
Generally used in keydown, keyup, keypress events.
The Key in the OnKeyDown and OnKeyUp events is Word type, indicating which key on the keyboard the user presses. The Key in OnKeyPress is Char, indicating what characters the user enters. One produces 8 (char) regular health values and one produces 16 (word) functional health values.
1.KeyPress is mainly used to capture numbers (note: including Shift+number symbols), letters (note: including capitalization), keypad, etc. except F1-12, SHIFT, Alt, Ctrl, Insert, Home, PgUp, Delete, End , PgDn, ScrollLock, Pause, NumLock, {menu key}, {start key} and ANSI characters outside the arrow keys, KeyDown and KeyUp can usually capture all keyboard keys except PrScrn (special keys for special keyboards are not discussed here)
2.KeyPress can only capture a single character
KeyDown and KeyUp can capture key combinations.
3.KeyPress can capture the case of a single character
4. KeyDown and KeyUp The KeyValue captured for a single character is a value, that is, the case of a single character cannot be determined.
5. KeyPress does not distinguish between numeric characters on the keypad and the main keyboard.
KeyDown and KeyUp distinguish between the numeric characters of the keypad and the main keyboard.
6. The PrScrn buttons KeyPress, KeyDown, and KeyUp cannot be captured.
Keydown is any key pressed by the keyboard
Keypress is the keyboard pressing any number key and any letter key
Keydown and keypress declaration format are very different
1 onkeydown event
Type TKeyEvent = procedure (Sender: TObject; var Key: Word; Shift: TShiftState) of object;
Property OnKeyDown: TKeyEvent;
This event occurs when any key is pressed. Look! It responds to the Word type and recognizes the Shift key state.
2 onkeypress event
Type TKeyPressEvent = procedure (Sender: TObject; var Key: Char) of object;
Property OnKeyPress: TKeyPressEvent;
The event responds to the character type Char, which only recognizes ASCII codes, and does not recognize combination keys and control keys and function keys. Pressing the function key and the control key does not generate the event, but generates an OnkeyDown event.
The three events related to TWinControl and keyboard are as follows:
OnKeyDown: key press
OnKeyPress: Has Ascii character generation
OnKeyUp: The key is released
Among them, OnKeyDown and OnKeyUp respond to any button, and the incoming parameter is
Var Key: scan value of the Word key
Shift: TShiftState represents the state of the control key, including Ctrl, Shift, Alt on the keyboard and the left, center, right and double click of the mouse.
The OnKeyPress event only responds to Ascii, the passed argument is
Var Key: Char Ascii character
//For example, F1-F10 only reacts with onKeydown
In addition, the TWincontrol. KeyPreview:Boolean property determines whether the control handles the key before the child control.
For example, the enter key,
Onkeypress event
If key=#13 then // trigger this event when you press the enter key
Do something
Onkeydown event
If key=13 then // trigger this event when you press the enter key
Do something
All of the KeyDown events should be judged as follows:
If Key = VK_RETURN then
...
All KeyPress events should be judged as follows:
If Key = #13 then
...
Postmessage(self.handle, wm_keydown, vk_tab, 0);
Keybd_event(VK_TAB,2,0,0);
Perform(WM_NEXTDLGCTL,0,0);
SelectNext(ActiveControl, True, True);
...
But obviously the return code TAB is obviously not suitable for BUTTON. When you press Enter on it, it will execute OnClick, so it will not TAB, you can use other keys instead of Enter.
》》》》》》》》》》
Key value
Inside the keydown event
Showmessage(inttostr(key));
Inside the keypress event
Showmessage(key);
I will know.
Form1.KeyPreview := True;
Procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
Begin
Showmessage(IntToStr(Key));
End;
Procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
Begin
Showmessage(IntToStr(Ord(Key)));
End;
{ Virtual Keys, Standard Set }
{$EXTERNALSYM VK_LBUTTON}
VK_LBUTTON = 1;
{$EXTERNALSYM VK_RBUTTON}
VK_RBUTTON = 2;
{$EXTERNALSYM VK_CANCEL}
VK_CANCEL = 3;
{$EXTERNALSYM VK_MBUTTON}
VK_MBUTTON = 4; { NOT contiguous with L & RBUTTON }
{$EXTERNALSYM VK_BACK}
VK_BACK = 8;
{$EXTERNALSYM VK_TAB}
VK_TAB = 9;
{$EXTERNALSYM VK_CLEAR}
VK_CLEAR = 12;
{$EXTERNALSYM VK_RETURN}
VK_RETURN = 13;
{$EXTERNALSYM VK_SHIFT}
VK_SHIFT = $10;
{$EXTERNALSYM VK_CONTROL}
VK_CONTROL = 17;
{$EXTERNALSYM VK_MENU}
VK_MENU = 18;
{$EXTERNALSYM VK_PAUSE}
VK_PAUSE = 19;
{$EXTERNALSYM VK_CAPITAL}
VK_CAPITAL = 20;
{$EXTERNALSYM VK_KANA }
VK_KANA = 21;
{$EXTERNALSYM VK_HANGUL }
VK_HANGUL = 21;
{$EXTERNALSYM VK_JUNJA }
VK_JUNJA = 23;
{$EXTERNALSYM VK_FINAL }
VK_FINAL = 24;
{$EXTERNALSYM VK_HANJA }
VK_HANJA = 25;
{$EXTERNALSYM VK_KANJI }
VK_KANJI = 25;
{$EXTERNALSYM VK_CONVERT }
VK_CONVERT = 28;
{$EXTERNALSYM VK_NONCONVERT }
VK_NONCONVERT = 29;
{$EXTERNALSYM VK_ACCEPT }
VK_ACCEPT = 30;
{$EXTERNALSYM VK_MODECHANGE }
VK_MODECHANGE = 31;
{$EXTERNALSYM VK_ESCAPE}
VK_ESCAPE = 27;
{$EXTERNALSYM VK_SPACE}
VK_SPACE = $20;
{$EXTERNALSYM VK_PRIOR}
VK_PRIOR = 33;
{$EXTERNALSYM VK_NEXT}
VK_NEXT = 34;
{$EXTERNALSYM VK_END}
VK_END = 35;
{$EXTERNALSYM VK_HOME}
VK_HOME = 36;
{$EXTERNALSYM VK_LEFT}
VK_LEFT = 37;
{$EXTERNALSYM VK_UP}
VK_UP = 38;
{$EXTERNALSYM VK_RIGHT}
VK_RIGHT = 39;
{$EXTERNALSYM VK_DOWN}
VK_DOWN = 40;
{$EXTERNALSYM VK_SELECT}
VK_SELECT = 41;
{$EXTERNALSYM VK_PRINT}
VK_PRINT = 42;
{$EXTERNALSYM VK_EXECUTE}
VK_EXECUTE = 43;
{$EXTERNALSYM VK_SNAPSHOT}
VK_SNAPSHOT = 44;
{$EXTERNALSYM VK_INSERT}
VK_INSERT = 45;
{$EXTERNALSYM VK_DELETE}
VK_DELETE = 46;
{$EXTERNALSYM VK_HELP}
VK_HELP = 47;
{ VK_0 thru VK_9 are the same as ASCII ’0’ thru ’9’ ($30 - $39) }
{ VK_A thru VK_Z are the same
As ASCII ’A’ thru ’Z’ ($41 - $5A) }
{$EXTERNALSYM VK_LWIN}
VK_LWIN = 91;
{$EXTERNALSYM VK_RWIN}
VK_RWIN = 92;
{$EXTERNALSYM VK_APPS}
VK_APPS = 93;
{$EXTERNALSYM VK_NUMPAD0}
VK_NUMPAD0 = 96;
{$EXTERNALSYM VK_NUMPAD1}
VK_NUMPAD1 = 97;
{$EXTERNALSYM VK_NUMPAD2}
VK_NUMPAD2 = 98;
{$EXTERNALSYM VK_NUMPAD3}
VK_NUMPAD3 = 99;
{$EXTERNALSYM VK_NUMPAD4}
VK_NUMPAD4 = 100;
{$EXTERNALSYM VK_NUMPAD5}
VK_NUMPAD5 = 101;
{$EXTERNALSYM VK_NUMPAD6}
VK_NUMPAD6 = 102;
{$EXTERNALSYM VK_NUMPAD7}
VK_NUMPAD7 = 103;
{$EXTERNALSYM VK_NUMPAD8}
VK_NUMPAD8 = 104;
{$EXTERNALSYM VK_NUMPAD9}
VK_NUMPAD9 = 105;
{$EXTERNALSYM VK_MULTIPLY}
VK_MULTIPLY = 106;
{$EXTERNALSYM VK_ADD}
VK_ADD = 107;
{$EXTERNALSYM VK_SEPARATOR}
VK_SEPARATOR = 108;
{$EXTERNALSYM VK_SUBTRACT}
VK_SUBTRACT = 109;
{$EXTERNALSYM VK_DECIMAL}
VK_DECIMAL = 110;
{$EXTERNALSYM VK_DIVIDE}
VK_DIVIDE = 111;
{$EXTERNALSYM VK_F1}
VK_F1 = 112;
{$EXTERNALSYM VK_F2}
VK_F2 = 113;
{$EXTERNALSYM VK_F3}
VK_F3 = 114;
{$EXTERNALSYM VK_F4}
VK_F4 = 115;
{$EXTERNALSYM VK_F5}
VK_F5 = 116;
{$EXTERNALSYM VK_F6}
VK_F6 = 117;
{$EXTERNALSYM VK_F7}
VK_F7 = 118;
{$EXTERNALSYM VK_F8}
VK_F8 = 119;
{$EXTERNALSYM VK_F9}
VK_F9 = 120;
{$EXTERNALSYM VK_F10}
VK_F10 = 121;
{$EXTERNALSYM VK_F11}
VK_F11 = 122;
{$EXTERNALSYM VK_F12}
VK_F12 = 123;
{$EXTERNALSYM VK_F13}
VK_F13 = 124;
{$EXTERNALSYM VK_F14}
VK_F14 = 125;
{$EXTERNALSYM VK_F15}
VK_F15 = 126;
{$EXTERNALSYM VK_F16}
VK_F16 = 127;
{$EXTERNALSYM VK_F17}
VK_F17 = 128;
{$EXTERNALSYM VK_F18}
VK_F18 = 129;
{$EXTERNALSYM VK_F19}
VK_F19 = 130;
{$EXTERNALSYM VK_F20}
VK_F20 = 131;
{$EXTERNALSYM VK_F21}
VK_F21 = 132;
{$EXTERNALSYM VK_F22}
VK_F22 = 133;
{$EXTERNALSYM VK_F23}
VK_F23 = 134;
{$EXTERNALSYM VK_F24}
VK_F24 = 135;
{$EXTERNALSYM VK_NUMLOCK}
VK_NUMLOCK = 144;
{$EXTERNALSYM VK_SCROLL}
VK_SCROLL = 145;
{ VK_L & VK_R - left and right Alt, Ctrl and Shift virtual keys.
Used only as parameters to GetAsyncKeyState() and GetKeyState().
No other API or message will distinguish left and right keys in this way. }
{$EXTERNALSYM VK_LSHIFT}
VK_LSHIFT = 160;
{$EXTERNALSYM VK_RSHIFT}
VK_RSHIFT = 161;
{$EXTERNALSYM VK_LCONTROL}
VK_LCONTROL = 162;
{$EXTERNALSYM VK_RCONTROL}
VK_RCONTROL = 163;
{$EXTERNALSYM VK_LMENU}
VK_LMENU = 164;
{$EXTERNALSYM VK_RMENU}
VK_RMENU = 165;
{$EXTERNALSYM VK_PROCESSKEY}
VK_PROCESSKEY = 229;
{$EXTERNALSYM VK_ATTN}
VK_ATTN = 246;
{$EXTERNALSYM VK_CRSEL}
VK_CRSEL = 247;
{$EXTERNALSYM VK_EXSEL}
VK_EXSEL = 248;
{$EXTERNALSYM VK_EREOF}
VK_EREOF = 249;
{$EXTERNALSYM VK_PLAY}
VK_PLAY = 250;
{$EXTERNALSYM VK_ZOOM}
VK_ZOOM = 251;
{$EXTERNALSYM VK_NONAME}
VK_NONAME = 252;
{$EXTERNALSYM VK_PA1}
VK_PA1 = 253;
{$EXTERNALSYM VK_OEM_CLEAR}
VK_OEM_CLEAR = 254;
:), in fact, do not remember, you are not using delphi, enter vk_f1 always in the ide, then hold down the ctrl key
Click on the vk_f1 you just entered, it will come out!
As for the value of key:char, it is the ascII code of key:word. You can see chr(vk_f1), chr(vk_enter), all can!
》》》》》》》》》》》》》》》》》》
The virtual key table in delphi help:
Vk_right right arrow key
Vk_down down arrow key
Vk_select select key
Vk_print print key (keyboard-specific)
Vk_execute execute key
Vk_snapshot print screen key
Vk_insert insert key
Vk_delete delete key
Vk_help help key
Vk_lwin left windows key (microsoft keyboard)
Vk_rwin right windows key (microsoft keyboard)
Vk_apps applications key (microsoft keyboard)
Vk_numpad0 0 key (numeric keypad)
Vk_numpad1 1 key (numeric keypad)
Vk_numpad2 2 key (numeric keypad)
Vk_numpad3 3 key (numeric keypad)
Vk_numpad4 4 key (numeric keypad)
Vk_numpad5 5 key (numeric keypad)
Vk_numpad6 6 key (numeric keypad)
Vk_numpad7 7 key (numeric keypad)
Vk_numpad8 8 key (numeric keypad)
Vk_numpad9 9 key (numeric keypad)
Vk_multiply multiply key (numeric keypad)
Vk_add add key (numeric keypad)
Vk_separator separator key (numeric keypad)
Vk_subtract subtract key (numeric keypad)
Vk_decimal decimal key (numeric keypad)
Vk_divide divide key (numeric keypad)
Vk_f1 f1 key
Vk_f2 f2 key
Vk_f3 f3 key
Vk_f4 f4 key
Vk_f5 f5 key
Vk_f6 f6 key
Vk_f7 f7 key
Vk_f8 f8 key
Vk_f9 f9 key
Vk_f10 f10 key
Vk_f11 f11 key
Vk_f12 f12 key
Vk_f13 f13 key
Vk_f14 f14 key
Vk_f15 f15 key
Vk_f16 f16 key
Vk_f17 f17 key
Vk_f18 f18 key
Vk_f19 f19 key
Vk_f20 f20 key
Vk_f21 f21 key
Vk_f22 f22 key
Vk_f23 f23 key
Vk_f24 f24 key
Vk_numlock num lock key
Vk_scroll scroll lock key
Vk_lshift left shift key (only used with getasynckeystate and getkeystate)
Vk_rshift right shift key (only used with getasynckeystate and getkeystate)
Vk_lcontrol left ctrl key (only used with getasynckeystate and getkeystate)
Vk_rcontrol right ctrl key (only used with getasynckeystate and getkeystate)
Vk_lmenu left alt key (only used with getasynckeystate and getkeystate)
Vk_rmenu right alt key (only used with getasynckeystate and getkeystate)
Vk_processkey process key
Vk_attn attn key
Vk_crsel crsel key
Vk_exsel exsel key
Vk_ereof erase eof key
Vk_play play key
Vk_zoom zoom key
Vk_noname reserved for future use
Vk_pa1 pa1 key
Vk_oem_clear clear key
Analog mouse
Mouse movement (movement amount dx, dy)
Mouse_event(MOUSEEVENTF_MOVE,dx,dy,0, 0 );
The mouse is pressed or released at (x, y)
Setcursorpos(x,y);
Mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 );
Mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0,
0, 0 );
Mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
Mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0 );
Mouse double click is simulated by two presses and release
Keyboard simulation
The general virtual key value (VK_) is obtained by the KeyDown or keyup event.
Special key value
Tab--9
Shift--16
Ctrl--17
Alt--18
CapsLock--20
Esc--27
Win--91,92
NumLock--144
ScrollLock--145
Press the button
Keybd_event(key, MapVirtualKey(key, 0), KEYEVENTF_KEYUP , 0 );
Release button
Keybd_event(key, MapVirtualKey(key, 0 ), 0 , 0 );
The above method works for most keys, and a few keys use different values.
》》》》》》》》》》》》》》》》》》》》》》》》》
Constant name Hexadecimal value Decimal value Corresponding button
VK_LBUTTON 01 1 Left button of the mouse
VK_RBUTTON 02 2 right mouse button
VK-CANCEL 03 3 Ctrl+Break (usually no processing required)
VK_MBUTTON 04 4 Middle button of the mouse (three-button mouse)
VK_BACK 08 8 Backspace key
VK_TAB 09 9 Tab
VK_CLEAR 0C 12 Clear key (numeric keypad 5 when Num Lock is off)
VK_RETURN 0D 13 Enter key
VK_SHIFT 10 16 Shift key
VK_CONTROL 11 17 Ctrl key
VK_MENU 12 18 Alt button
VK_PAUSE 13 19 Pause button
VK_CAPITAL 14 20 Caps Lock button
VK_ESCAPE 1B 27 Ese key
VK_SPACE 20 32 Spacebar
VK_PRIOR 21 33 Page Up button
VK_NEXT 22 34 Page Domw button
VK_END 23 35 End button
VK_HOME 24 36 Home button
VK_LEFT 25 37 LEFT ARROW key (←)
VK_UP 26 38 UP ARROW button (↑)
VK_RIGHT 27 39 RIGHT ARROW button (→)
VK_DOWN 28 40 DOWN ARROW button (↓)
VK_Select 29 41 Select button
VK_PRINT 2A 42
VK_EXECUTE 2B 43 EXECUTE button
VK_SNAPSHOT 2C 44 Print Screen button (screen capture)
VK_Insert 2D 45 Ins key (numeric keypad 0 when Num Lock is off)
VK_Delete 2E 46 Del key (numeric keypad when Num Lock is off.)
VK_HELP 2F 47 Help button
VK_0 30 48 0 button
VK_1 31 49 1 button
VK_2 32 50 2 button
VK_3 33 51 3 button
VK_4 34 52 4 button
VK_5 35 53 5 button
VK_6 36 54 6 button
VK_7 37 55 7 button
VK_8 38 56 8 button
VK_9 39 57 9 keys
VK_A 41 65 A key
VK_B 42 66 B button
VK_C 43 67 C key
VK_D 44 68 D button
VK_E 45 69 E button
VK_F 46 70 F key
VK_G 47 71 G button
VK_H 48 72 H button
VK_I 49 73 I button
VK_J 4A 74 J key
VK_K 4B 75 K button
VK_L 4C 76 L key
VK_M 4D 77 M button
VK_N 4E 78 N button
VK_O 4F 79 O button
VK_P 50 80 P key
VK_Q 51 81 Q button
VK_R 52 82 R button
VK_S 53 83 S key
VK_T 54 84 T key
VK_U 55 85 U button
VK_V 56 86 V key
VK_W 57 87 W button
VK_X 58 88 X button
VK_Y 59 89 Y key
VK_Z 5A 90 Z button
VK_NUMPAD0 60 96 number key 0 key
VK_NUMPAD1 61 97 number keys 1 key
VK_NUMPAD2 62 98 number keys 2 keys
VK_NUMPAD3 62 99 number keys 3 keys
VK_NUMPAD4 64 100 number keys 4 keys
VK_NUMPAD5 65 101 number key 5 key
VK_NUMPAD6 66 102 number key 6 key
VK_NUMPAD7 67 103 number keys 7 keys
VK_NUMPAD8 68 104 number keys 8 keys
VK_NUMPAD9 69 105 number keys 9 keys
VK_MULTIPLY 6A 106 * keys on the numeric keypad
VK_ADD 6B 107 + key on the numeric keypad
VK_SEPARATOR 6C 108 Separator button
VK_SUBTRACT 6D 109 - Key on the numeric keypad
VK_DECIMAL 6E 110. Key on the numeric keypad
VK_DIVIDE 6F 111 / key on the numeric keypad
VK_F1 70 112 F1 button
VK_F2 71 113 F2 button
VK_F3 72 114 F3 button
VK_F4 73 115 F4 button
VK_F5 74 116 F5 button
VK_F6 75 117 F6 button
VK_F7 76 118 F7 button
VK_F8 77 119 F8 button
VK_F9 78 120 F9 button
VK_F10 79 121 F10 button
VK_F11 7A 122 F11 key
VK_F12 7B 123 F12 button
VK_NUMLOCK 90 144 Num Lock key
VK_SCROLL 91 145 Scroll Lock button
Not mentioned above: (both on the big keyboard)
VK_LWIN 91 left win button
VK_RWIN 92 right win button
VK_APPS 93 Right Ctrl left button, click equivalent to click the right mouse button, a shortcut menu will pop up
186 ; (semicolon)
187 = key
188, key (comma)
189 - key (minus sign)
190. Key (period)
191 / key
192 `key (below Esc)
219 [key
220 / key
221 ] key
222 ‘key (quotation mark)
Procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
Begin
If key=VK_DELETE then
Key:=0;
End;
Del
Phi6.0, 2000 through Top
Block all keys except numbers in keydown
It should also allow Ctr+C/X/V, so it should be summarized as follows:
Procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
Begin
If not (Key in [‘0‘..‘9‘, #3, #22, #24, #8, #13, #45]) then Key := #0;
End;
Procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
Begin
If (key>#57) and (key<#48) then
Key:=#0;
End;
I think you'd better write your routine.
If, as you said by CKEN, you want to mask key events, you should actually assign them directly:
Key:=0;
(Note that it is not Key:=#0, because the Key here is a Word type. In the keypress event, the value of the key is Char, it is necessary to use "#")
Good luck
Can be implemented in KeyDown
If key=vk_numpad0 then (If you are the 0 key of the keypad, do what you want to do)
Below is the value of the keypad
VK_NUMPAD0 0 key (numeric keypad)
VK_NUMPAD1 1 key (numeric keypad)
VK_NUMPAD2 2 key (numeric keypad)
VK_NUMPAD3 3 key (numeric keypad)
VK_NUMPAD4 4 key (numeric keypad)
VK_NUMPAD5 5 key (numeric keypad)
VK_NUMPAD6 6 key (numeric keypad)
VK_NUMPAD7 7 key (numeric keypad)
VK_NUMPAD8 8 key (numeric keypad)
VK_NUMPAD9 9 key (numeric keypad)
VK_MULTIPLY Multiply key (numeric keypad)
VK_ADD Add key (numeric keypad)
VK_SEPARATOR Separator key (numeric keypad)
VK_SUBTRACT Subtract key (numeric keypad)
VK_DECIMAL Decimal key (numeric keypad) VK_DIVIDE Divide key (numeric keypad)
[difference between]delphi:keydown and KeyPress, key combinations