[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'DBCtrls' (#lcl)

# TDBMemo.KeyDown

Handles key down events in the data-aware control.

## Declaration

Source position: dbctrls.pp line 1018

`protected procedure TDBMemo.KeyDown(`
`var Key: Word;`
`Shift: TShiftState`
`); override;`

## Arguments

`Key` |  | Virtual key code examined in the method.
`Shift` |  | Sift modifier for the key code.

## Description

KeyDown is an overridden method used to handle key down events in the control.

Key is the virtual key code examined and handled in the method. Shift is the Shift-Ctrl-Alt modifier for the virtual key code.

KeyDown calls the inherited method to handle the key down event in the method form ancestor class. If Key is not already applied, it is checked for the following values:

VK_ESCAPE
  Editing is being cancelled. Calls the Reset method in the TFieldDataLink instance used in the class. Call SelectAll to re-select content in the control. Sets Key to VK_UNKNOWN to indicate that it was handled in the method.
VK_DELETE, VK_BACK
  Content is being removed in the control. If the Field in the internal TFieldDataLink is not editable, the value in Key is set VK_UNKNOWN.

For the macOS (Darwin) platform, additional virtual key codes are detected (and discarded) if the contents of the field in the linked dataset cannot be modified. These keys include:

VK_0..VK_9
  numeric characters not on the numeric keypad
VK_A..VK_Z
  alphabetic characters
VK_SPACE
  space character
VK_NUMPAD0..VK_NUMPAD9
  numeric digits on the numeric keypad
VK_MULTIPLY, VK_DIVIDE, VK_ADD, VK_SUBTRACT
  operators on the numeric keypad
VK_SEPARATOR, VK_DECIMAL
  padded and non-padded Decimal separators
VK_OEM_1
  ';:' keycap on the US standard keyboard
VK_OEM_2
  '/?' keycap on the US standard keyboard
VK_OEM_3
  '`~' keycap on the US standard keyboard
VK_OEM_4
  '[{' keycap on the US standard keyboard
VK_OEM_5
  '\|' keycap on the US standard keyboard
VK_OEM_6
  ']}' keycap on the US standard keyboard
VK_OEM_7
  ''"' (Apostrophe and Quote) keycap on the US standard keyboard
VK_OEM_8
  miscellaneous character; varies by keyboard layout

For these macOS-specific keys, the value in Key is set to 0 if the field cannot be modified.

## Version info

Modified in LCL version 3.6 to handle additional data keys on the macOS (Darwin) platform.

## See also

TWinControl.KeyDown |  | Signals OnKeyDown event handlers (when assigned).