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

# TPickListCellEditor.KeyDown

Handles a key down message for the cell editor.

## Declaration

Source position: grids.pas line 283

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

## Arguments

`Key` |  | Key code for the key down event.
`Shift` |  | Shift, Alt, or Ctrl modifier for the key down event.

## Description

KeyDown is an overridden method in TPickListCellEditor. It extends the inherited method to ensure that specific key codes are applied to the grid or the editor control as needed.

KeyDown calls the inherited method on entry to handle Tab, Return, and Escape key code in the manner needed for the TCustomComboBox ancestor. It adds support for the following keys:

F2
  Clears the selection length and moves the caret position to the end of the Text in the cell editor.
Return
  Calls the EditorkeyDown method for the grid control, discards the key code, and closes the drop down in the editor control when it is expanded.
Delete
  Discards the key code if the grid control or the editor cannot be modified.
Cursor Up, Cursor Down
  Calls the KeyDown method for the grid control if the drop down is not expanded for the cell editor.
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.
Home, End
  Ignored in the key down handler.
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

TCustomComboBox.KeyDown |  | Filters keys used to traverse the list.