TDBGrid prevents record insertion due to spurious exit event
Original Reporter info from Mantis: luca @olivluca
-
Reporter name: Luca Olivetti
Original Reporter info from Mantis: luca @olivluca
- Reporter name: Luca Olivetti
Description:
When a TDBGrid is not the first control in the taborder and a cell editor is visible (e.g. with dgAlwaysShowEditor) and dgCancelOnExit is true, it's impossible to insert a record, since a spurious exit event is generated which cancels the insert.
Steps to reproduce:
Using the attached project:
-
make sure the grid is populated with some rows (it should be since there's a data file in the project)
-
click somewhere in the middle of the grid
-
click the "Insert record" (+) button in the db navigator
no record is inserted and, if you look carefully, you'll see that edit1 will flicker.
If you then click button1 to hide edit1 then it's possible to insert the record.
It would also work if the grid is the first control in the taborder.
Additional information:
Win32 specific (doesn't happen in Linux) I cannot currently test win64.
This is the call stack when I put a breakpoint in TCustomDBGrid.DoExit but I don't know what triggers the event.
#0 TCUSTOMDBGRID__DOEXIT(<error reading variable>) at dbgrids.pas:2630
#1 TWINCONTROL__CMEXIT({MSG = 45083, WPARAM = 0, LPARAM = 0, RESULT = 0, WPARAMLO = 0, WPARAMHI = 0, WPARAMFILLER = {}, LPARAMLO = 0, LPARAMHI = 0, LPARAMFILLER = {}, RESULTLO = 0, RESULTHI = 0, RESULTFILLER = {}}, <error reading variable>) at .\include\wincontrol.inc:8134
#2 TOBJECT__DISPATCH(void, <error reading variable>) at D:\fpc-2.6.4\rtl\inc\objpas.inc:592
#3 TCONTROL__WNDPROC({MSG = 45083, WPARAM = 0, LPARAM = 0, RESULT = 0, WPARAMLO = 0, WPARAMHI = 0, WPARAMFILLER = {}, LPARAMLO = 0, LPARAMHI = 0, LPARAMFILLER = {}, RESULTLO = 0, RESULTHI = 0, RESULTFILLER = {}}, <error reading variable>) at .\include\control.inc:2108
#4 TWINCONTROL__WNDPROC({MSG = 45083, WPARAM = 0, LPARAM = 0, RESULT = 0, WPARAMLO = 0, WPARAMHI = 0, WPARAMFILLER = {}, LPARAMLO = 0, LPARAMHI = 0, LPARAMFILLER = {}, RESULTLO = 0, RESULTHI = 0, RESULTFILLER = {}}, <error reading variable>) at .\include\wincontrol.inc:5326
#5 TCUSTOMGRID__WNDPROC({MSG = 45083, WPARAM = 0, LPARAM = 0, RESULT = 0, WPARAMLO = 0, WPARAMHI = 0, WPARAMFILLER = {}, LPARAMLO = 0, LPARAMHI = 0, LPARAMFILLER = {}, RESULTLO = 0, RESULTHI = 0, RESULTFILLER = {}}, <error reading variable>) at grids.pas:4580
#6 TCUSTOMDBGRID__WNDPROC({MSG = 45083, WPARAM = 0, LPARAM = 0, RESULT = 0, WPARAMLO = 0, WPARAMHI = 0, WPARAMFILLER = {}, LPARAMLO = 0, LPARAMHI = 0, LPARAMFILLER = {}, RESULTLO = 0, RESULTHI = 0, RESULTFILLER = {}}, <error reading variable>) at dbgrids.pas:1308
#7 TCONTROL__PERFORM(45083, 0, 0, <error reading variable>) at .\include\control.inc:1445
#8 SENDENTEREXITLOOP(0x161ec24) at .\include\customform.inc:2339
#9 TCUSTOMFORM__SETFOCUSEDCONTROL(0xc2778, <error reading variable>) at .\include\customform.inc:2446
#10 TWINCONTROL__WNDPROC({MSG = 7, WPARAM = 0, LPARAM = 0, RESULT = 1, WPARAMLO = 0, WPARAMHI = 0, WPARAMFILLER = {}, LPARAMLO = 0, LPARAMHI = 0, LPARAMFILLER = {}, RESULTLO = 1, RESULTHI = 0, RESULTFILLER = {}}, <error reading variable>) at .\include\wincontrol.inc:5245
#11 DELIVERMESSAGE(0xc2778, void) at lclmessageglue.pas:112
#12 WINDOWPROC(5243578, 7, 3277580, 0) at .\win32\win32callback.inc:2480
#13 USER32!GetDC at :0
#14 TWINCONTROL__AUTOSIZEPHASES(<error reading variable>) at .\include\wincontrol.inc:2371
#15 USER32!GetDC at :0
#16 DISPOSECOMBOEDITWINDOWINFO(0x0) at .\win32\win32callback.inc:216
#17 USER32!DefWindowProcW at :0
#18 ?? at :0
Mantis conversion info:
- Mantis ID: 26929
- Version: 1.2.6
- Fixed in version: 1.3 (SVN)
- Fixed in revision: 46680 (#7b02f9eb)
- Target version: 1.4