In my DBGRID
, i have a field that populated with default name of current configuration
when i create new record.
When i set the dgtabs option
to true
, I can navigate through the grid using the TAB and SHIFT+TAB keys. I need to navigate without create new record or create new record with field populated by the current configuration name.
How can do that?
or create new record with field populated by the current configuration name.
You can do that simply by creating an OnNewRecord event handler for the dataset connected to the DBGrid and saving the configuration name to the relevant field in that.
Regarding how to avoid navigating the grid using Tab & Shift Tab opening the New Record row, a simple way, which may be acceptable (or not) to your situation is to set the DBGrid's Options.dgEditing to False. Then, the grid will not open the New Record row when Tab or Shift Tab is pressed or even if you press the Insert
key in the DBGrid.
If that's not appropriate, you might take a look at my answer to this q
which may give you a clue if you need it.