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

TStringCellEditor.KeyDown

Handles a key down event for the control.

Declaration

Source position: grids.pas line 243

protected procedure TStringCellEditor.KeyDown(

  var Key: Word;

  Shift: TShiftState

); override;

Arguments

Key

  

Key code handled in the method.

Shift

  

Shift, Ctrl, or Alt modifier the key code.

Description

KeyDown is an overridden method in TStringCellEditor which handles a key down event for the cell editor. It calls the inherited method on entry to handle the virtual key codes normally supported in the TCustomMaskEdit control. It extends the inherited method to provide support for the following keys:

F2
Allows the grid control to handle the key. If editing is not enabled for the control, the current text selection in the editor is cleared. When editing is enabled and FastEditing is True, SelectAll is called select all of the content in Text.
Delete, Backspace
Discards the value in key when the grid control or the column is marked as read-only. Otherwise, the key is forwarded to the EditorKeyDown method in the grid control.
Cursor Up, Cursor Down
Forwards the key to the KeyDown method in the grid control.
Cursor Left, Cursor Right
Handles cell navigation for the grid control, and caret position changes for the cell editor. Uses SelStart to determine the position for the selected text in the editor. Forwards the key to the grid control or its Editor control as needed for the current selection.
Escape
Allows the grid control to handle the key. When not handled, the unedited value is restored to the cell and the EditorHide method for the grid is called to hide the editor control.

Other unhandled key codes are forwarded to the EditKeyDown method for the grid control.

See also

TCustomMaskEdit.KeyDown

  

Performs actions needed to apply key down messages.


Version 4.0 Generated 2025-05-03 Home