The KeyPress (Sender: TObject; var Key: Char); when the user presses character keys (letters, numbers) on the keyboard will trigger the event, it will not function key (F1-F12, Ctrl, Alt , Shift)
KeyUp (Sender: TObject; var Key: Word; the Shift: TShiftState); when you press a key on the keyboard release triggered OnKeyUp event (any key triggers)
KeyDown (Sender: TObject; var Key: Word; the Shift: TShiftState); press any button will trigger this event
KeyPress and two other difference is that, Key values are characters, the other is digital (word 0 · 65535)
Special attention is Shift: TShiftState Its value is: TShiftState = set of (ssShift, ssAlt, ssCtrl, ssLeft, ssRight, ssMiddle, ssDouble); call Examples are:
ssCtrl in Shift
or
[ssCtrl]
Edit call:
KeyPress
var key: char begin key: = '# 13 And'; EditKeyPress (nīl, key); end;
KeyUp
var key:word begin key:=13; EditKeyUp(nil,key,[]); end;
Here not shift value, it is written []
Keydown
var key:word begin key:=13; EditKeydown(nil,key,[]); end;