TEgFireGrid edits the dataset in place, with the rules
of the VCL TDBGrid. Editing needs egoEditing
in Options
(on by default), a dataset that can be edited, and a column that is not
ReadOnly.
The editor of the active cell opens with:
TabOnEnter);PickListOnly
column only opens its list, and a date picker makes the value null
(unless the column is Required).With egoAlwaysShowEditor the edit box of text, number
and pick list cells (not PickListOnly) shows by itself
whenever the grid has the focus; a memo cell’s editor shows by itself
only after a Tab move (Tab, Shift+Tab, or Enter with TabOnEnter),
not after the arrow keys. From code: BeginEdit.
| Cell | Editor |
|---|---|
| Text | An edit box. With a PickList,
a combo box offering the list; with PickListOnly,
only the list. |
| Number | An edit box that accepts only the characters of the number: digits,
one sign, one decimal separator (the system’s), and an exponent for
floating-point fields. It shows the field’s EditFormat,
never its display format. |
| Memo, or a text with line breaks | A multi-line editor over the cell and part of its neighbours. Shift+Enter in a simple edit box turns it into the multi-line editor. |
| Date, time, date-time | The field’s text, in the system’s formats; or, with DateEditor
gdePicker, a date picker (plus a time box for a
date-time). |
| Lookup field | A list of the lookup dataset’s values, with a (none) item unless the value is required; the choice writes the key fields. |
| Boolean | No editor: a click or tap on the box, or Space, toggles it. |
| Picture | Not editable in the grid. |
On Android the number editors bring up the numeric keyboard, and with
EditRowToTop
the edited row is scrolled above the virtual keyboard.
The dataset enters edit state at the first change
made in the editor, not when the editor opens. Ending the editor (Enter,
Tab, a click elsewhere, the focus leaving) writes the value to the
field; the editor never posts. The row is posted when
another row becomes active, as in the VCL grid, or when the application
posts it (a navigator, code). An empty text makes a number, date or time
null; a text field gets an empty string. A Required
column refuses to be emptied.
A check box is the exception: a toggle posts the row at once, unless
the row was already being edited (OnCheckChange
fires first).
If the dataset refuses a value, the error is shown after the editor has closed and the cell shows its previous value.
| Key | Edit box | Multi-line editor |
|---|---|---|
| Enter | Writes and closes (with egoAlwaysShowEditor it stays
open) |
New line |
| Ctrl+Enter | Writes and closes | Writes and closes |
| Shift+Enter | Becomes the multi-line editor, with a line break | New line |
Enter with TabOnEnter |
Writes and moves to the next cell | New line (Ctrl+Enter moves on) |
| Tab / Shift+Tab | Writes and moves to the next / previous cell
(egoTabs) |
Same |
| Up / Down | Write and move to the row above / below | Move between the lines; leave from the first / last line |
| Esc | Text changed: puts it back and closes. Unchanged: cancels the whole row | Same |
| Back (Android) | Writes and gives the focus back to the grid | Same |
With egoAlwaysShowEditor the keys that move about the
grid reach it from the edit box as in the VCL grid: PgUp and PgDn
always, Left, Right, Home and End when the caret is at that end of the
text.
Esc in the grid, with the row in edit state, cancels
the row (the dataset’s Cancel). With
egoCancelOnExit, a new row left untouched is cancelled when
the focus leaves the grid. On Android, Back on the grid
posts a row still in edit state before the screen closes; if the dataset
refuses it, the screen stays open with the error.