TCustomDBGrid.KeyDown
KeyDown handles special keys and signals the OnKeyDown event handler.
Declaration
Source position: dbgrids.pas line 491
Arguments
Key |
|
Key code examined in the method. |
Shift |
|
Shift, Ctrl, or Alt modifier for the key. |
Description
KeyDown ensures that keys which affect navigation and editing operations are handled in the grid control. KeyDown handles the following keys:
- Tab
- Advances to the next column when dgTabs is included in Options. Otherwise exits the control.
- Shift + Tab
- Moves to the previous column when dgTabs is included in Options. Otherwise exits the control.
- Return
- Enables the editor for the cell when dgEditing is included in Options. Otherwise advances to the next column.
- Ctrl + Delete
- Deletes the selected row when dgDisableDelete has not been included in Options. A confirmation dialog is displayed when dgConfirmDelete is included in Options.
- Up
- Moves to the previous row in the dataset. The currently selected column remains the same.
- Down
- 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 dgDisableInsert has not been included in Options.
- Shift + Up
- When dgMultiSelect and dgPersistentMultiSelect have been included in the grid Options, SelectedRows is extended to include a bookmark to the preceding row in the grid control (when available). If multi-select has not been enabled in Options, the current selection in the control is cleared and the new row is selected.
- Shift + Down
- When dgMultiSelect and dgPersistentMultiSelect have been included in the grid Options, SelectedRows is extended to include a bookmark to the next row in the grid control (when available). If multi-select has not been enabled in Options, the current selection in the control is cleared and the new row is selected.
- Page Up
- Moves towards the beginning of the dataset by the number of rows specified in VisibleRows.
- Page Down
- Moves towards the end of the dataset by the number of rows specified in VisibleRows.
- Escape
- Cancels an active editor for the selected cell. Clears pending modifications to the Field for the column.
- Insert
- 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.
- Home
- Changes the selected cell to first non-fixed column in the control. An active editor is removed.
- Ctrl + Home
- Moves to the first row in the dataset. An active editor is removed.
- End
- Changes the selected cell to the last visible column in the control. An active editor is removed.
- Ctrl + End
- Moves to the last row in the dataset. An active editor is removed.
- Space
- Toggles the value in a column which uses a check box editor.
- Ctrl + Multiply (Num Pad *)
- 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.
Version 3.2 |
Generated 2024-02-25 |
Home |