Problems writing a cell editor for a TDBGrid
Original Reporter info from Mantis: TWhyman
-
Reporter name: Tony Whyman
Original Reporter info from Mantis: TWhyman
- Reporter name: Tony Whyman
Description:
I've been trying to create my own TDBGrid cell editor - actually a TDateTime editor based on TDateEdit and using TStringCellEditor as a template.
The problem is that you cannot replicate TStringCellEditor outside of the Grids unit as it uses the TCustomGrid protected methods "EditorTextChanged" and "EditorIsReadOnly". OK, you can always use a hack to get at a protected method - but you shouldn't have. There seems to be no good reason for these methods to not be public. So I am proposingthat TCustomGrid.EditorTextChanged and TCustomGrid.EditorIsReadOnly are changed to public methods.
Additional information:
Digging Deeper into TDBGrid, you find also that for a cell editor to work, you have to call TCustomGrid.EditorIsReadOnly at least once.
The problem is that TCustomDBGrid overrides EditorIsReadOnly and this override is the only place where FDataLink.Edit is called and it also calls TCustomDBGrid.EditingColumn. In the latter case, if TCustomDBGrid.EditingColumn is not called with argument of "true", then TCustomDBGrid.UpdateData refuses to update the dataset when the cell editor terminates.
In summary without making TCustomGrid.EditorIsReadOnly public, you don't have much hope of writing a cell editor that works with a TDBGrid.
Mantis conversion info:
- Mantis ID: 32329
- OS: Linux Mint
- OS Build: 18.2
- Platform: x86_64
- Version: 1.8RC4
- Fixed in version: 1.9 (SVN)
- Fixed in revision: 55745 (#1bd078ef)
- Target version: 1.8