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

TCustomDBGrid.KeyDown

KeyDown handles special keys and signals the OnKeyDown event handler

Declaration

Source position: dbgrids.pas line 489

protected procedure TCustomDBGrid.KeyDown(

  var Key: Word;

  Shift: TShiftState

); override;

Description

KeyDown ensures that keys which affect navigation and editing operations are handled in the grid control. KeyDown handles the following keys:

Advances to the next column when dgTabs is included in Options. Otherwise exits the control.
Moves to the previous column when dgTabs is included in Options. Otherwise exits the control.
Enables the editor for the cell when dgEditing is included in Options. Otherwise advances to the next column.
Deletes the selected row when dgDisableDelete has not been included in Options. A confirmation dialog is displayed when dgConfirmDelete is included in Options.
Moves to the previous row in the dataset. The currently selected column remains the same.
Moves to the next row in the dataset. The currently selected column remains the same. Appends a new row when positioned at the end of the dataset and dgDiableInsert has not been included in Options.
Moves towards the beginning of the dataset by the number of rows specified in VisibleRows.
Moves towards the end of the dataset by the number of rows specified in VisibleRows.
Cancels an active editor for the selected cell. Clears pending modifications to the Field for the column.
Inserts a new row at the current row position when dgDisableInsert has not been included in Options. The actual position for the new row can change if the dataset has sorting or ordering capabilities.
Changes the selected cell to first non-fixed column in the control. An active editor is removed.
Moves to the first row in the dataset. An active editor is removed.
Changes the selected cell to the last visible column in the control. An active editor is removed.
Moves to the last row in the dataset. An active editor is removed.
Toggles the value in a column which uses a checkbox editor.
Toggles the selected state for the current row when dgMultiSelect is included in Options.

KeyDown reads and writes values in GridFlags as needed while handling cell editors and performing dataset navigation.

KeyDown calls the inherited KeyDown method to process keys not explicitly handled by the data-aware control.

KeyDown signals the OnKeyDown event handler when it has been assigned for the control.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.