Icon TKeyDownEvent

Unit: WebCtrls

TKeyDownEvent = function (Sender: TObject; Key: Integer;
      ShiftKey, CtrlKey, AltKey: Boolean): Boolean of object

Available In: Client Applications

The TKeyDownEvent type is a common event type that is used by controls to provide notification that a key is being pressed.

The Sender parameter represents the class instance that triggered the event. The Key parameter represents the ordinal key code of the key pressed, and the ShiftKey, CtrlKey, AltKey parameters represent whether the Shift, Control, and/or Alt keys were also pressed.

The Key value may represent a virtual key code. Certain keys, such as the Insert, Delete, and navigation keys, use virtual key codes since these keys do not correspond to an ordinal Unicode character value. The following virtual key code constants are defined in the WebUI unit for your convenience:

VK_BACK = 8;
VK_TAB = 9;
VK_RETURN = 13;
VK_ESCAPE = 27;
VK_SPACE = 32;
VK_PRIOR = 33;
VK_NEXT = 34;
VK_END = 35;
VK_HOME = 36;
VK_LEFT = 37;
VK_UP = 38;
VK_RIGHT = 39;
VK_DOWN = 40;
VK_INSERT = 45;
VK_DELETE = 46;

To not allow the keystroke, return False as the result to any event handler attached to this event. To allow the keystroke, return True.
Image