AutoEdit
AutoEdit
Put cell into edit mode when it gets focus
Enumerated type, possible values are:
Default | Grid default rules |
---|---|
AutoEditOff | Not in AutoEdit mode |
AutoEditOn | Enables AutoEdit mode for all the cells of the grid |
NoEditFixed | Enables AutoEdit mode for those cells of the grid that are not fixed |
ServerEdit | Enables Autoedit mode for the cell and allows the ServerEdit() event to be triggered |
Introduced in KCML version 6.00
The AutoEdit property allows a much simpler and more efficient editing mode than the older EditCell(), EditRow() and EditGrid() methods. It is particularly well suited to data aware grids where the rows represent rows in a database table. If enabled then clicking on a cell will put the row into edit mode allowing the clicked cell to be edited directly. When combined with the TabThrough and HideSelection styles, the grid can be made to behave as if it were a collection of edit boxes, as in the example:
The server will be alerted with an EditRowNotify() event when the user clicks on a new row. This event handler has access to both the previous row, if any, in CursorRow and the new row in the NewRow property so the program can update the old row in the database and take a lock on the new row. The EditRowNotify() event will also trigger when the focus leaves the grid entirely. In this case the NewRow property will then be zero so the program can update the database for the row that has been left.
The grid should normally be put into AutoEdit mode using the NoEditFixed value as this protects any fixed row or column heading. The AutoEditOn value will allow these cells to be edited which may not be desirable.
The ServerEdit enumeration allows a finer control over how AutoEdit mode works. Typically an entire grid might be put into Autoedit by applying the NoEditFixed enumeration to the whole control. Individual cells might then have their AutoEdit property set to ServerEdit to allow them to generate a ServerEdit() event as it becomes the current cell. This event can be used to allow complex processing to take place at that point, typically bringing up a child dialog.
Note: | If a grid is in AutoEdit mode then you must not use the EditCell(), EditRow() and EditGrid() direct editing modes on it. These techniques are mutually exclusive. |