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

# TCustomDrawGrid.KeyDown

Handles key down events for the grid control.

## Declaration

Source position: grids.pas line 1434

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

## Arguments

`Key` |  | Key code examined in the method.
`Shift` |  | Shift, Alt, Ctrl modifier for the key code.

## Description

KeyDown is an overridden method in TCustomDrawGrid, and calls the inherited method on entry. KeyDown ensures that the Space (VK_SPACE) key code is properly applied to the control for a cell using the check box button style.

VK_SPACE (Space)
  Calls the ToggleCheckbox method to toggle the checked state for the cell at Col and Row. Key is set to 0 (zero) to indicate that is has been handled in the method.

Called from EditorKeyDown when key down events are enabled in the EditorOptions for the control.

## See also

TCustomGrid.KeyDown |  | Handles key down events for the grid control.
TCustomGrid.EditorKeyDown |  | Implements the OnKeyDown event handler for the cell editor.
TCustomGrid.EditorOptions |  | The option flags sent to the Editor control in the grid.