TDBEdit.KeyDown procedure
Handles key down events in the control.
Declaration
procedure KeyDown(var Key: Word; Shift: TShiftState); overrideArguments
Key | Virtual key code examined and applied in the method. |
Shift | Key modifier examined and applied in the method. |
Description
KeyDown is an overridden method in
TDBEdit. KeyDown
calls the inherited method, and ensures that the specified virtual key code
and modifier are applied in the manner needed for the data-aware control.
KeyDown handles the following virtual key codes:
- VK_ESCAPE
- Cancels an active edit and resets the state for the DataSource. Calls the
Resetmethod in the internalTFieldDataLink, and re-selects the content in the control. Sets Key to the value VK_UNKNOWN. - VK_DELETE or VK_BACK
- Sets the value in Key to VK_UNKNOWN when the control is used on a field that cannot be edited.
- VK_RETURN
- Calls the
UpdateRecordmethod in the internalTFieldDataLinkinstance when it is in an edit state.
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.
Modified in LCL version 3.6 to handle additional data keys on the macOS (Darwin) platform.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
