View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0026916||Lazarus||Database Components||public||2014-10-21 12:54||2014-10-22 17:30|
|Reporter||Luca Olivetti||Assigned To||Jesus Reyes|
|Product Version||1.2.6||Product Build|
|Target Version||1.4||Fixed in Version||1.3 (SVN)|
|Summary||0026916: TDBGrid on a TPageControl generates "List index out of bounds" error due to spurious exit event|
|Description||When you place a TDbgrid on a TTabSheet while appending a record and clicking on another cell of the same record, a spurious exit event is generated which cancels the edit and eventually causes a "list index out of bounds" error since the record is no longer there.|
No such spurious exit event is generated if there's no TPageControl/TTabSheet on the form.
|Steps To Reproduce||In the attached project:|
1) go to the last record in either grid
2) use the keyboard down arrow. A new record is appended. Don't type anything in the edit box
3) use the mouse to click on another cell of the same (appended) record
A "list index out of bounds" exception is generated. If you then click the button to remove the pagecontrol and repeat the steps, no exception is generated.
|Additional Information||If you put a breakpoint on the procedure TCustomDBGrid.DoExit (lcl/dbgrids.pas) you'll see that step 3 will trigger the breakpoint when there's a pagecontrol and won't trigger it without.|
That procedure will cancel the edit, hence causing the exception.
As a workaround I set dgCancelOnEdit to false, so that the procedure doesn't cancel the edit.
|Fixed in Revision||46642|
bug.zip (3,418 bytes)
||It seems to be specific to win32, doesn't happen with linux/gtk or linux/qt|
bug2.zip (2,718 bytes)
It turns out that the TPagecontrol/TTabsheet was a red herring (but I cannot change the summary): it's enough to put 2 dbgrids in the same form, as in the attached bug2.zip.
The strange thing is that it only happens to the grid on the right (which I copy-pasted from the other one), but if I delete the first one (with the button) then the bogus exit event isn't generated.
Note also that it only happens with dgAlwaysShowEditor (which I need to set to overcome another limitation of the TDBGrid).
This patch can be merged to fixes if needed.
||Thanks Jesús that was fast.|
|2014-10-21 12:54||Luca Olivetti||New Issue|
|2014-10-21 12:54||Luca Olivetti||File Added: bug.zip|
|2014-10-21 12:59||Luca Olivetti||Note Added: 0078456|
||Category||LCL => Database Components|
||Tag Attached: dbgrid|
||Tag Attached: TPageControl|
|2014-10-21 15:47||Luca Olivetti||File Added: bug2.zip|
|2014-10-21 15:52||Luca Olivetti||Note Added: 0078471|
|2014-10-21 18:22||Jesus Reyes||Assigned To||=> Jesus Reyes|
|2014-10-21 18:22||Jesus Reyes||Status||new => assigned|
|2014-10-22 16:00||Jesus Reyes||Fixed in Revision||=> 46642|
|2014-10-22 16:00||Jesus Reyes||LazTarget||- => 1.4|
|2014-10-22 16:00||Jesus Reyes||Note Added: 0078520|
|2014-10-22 16:00||Jesus Reyes||Status||assigned => resolved|
|2014-10-22 16:00||Jesus Reyes||Fixed in Version||=> 1.3 (SVN)|
|2014-10-22 16:00||Jesus Reyes||Resolution||open => fixed|
|2014-10-22 16:00||Jesus Reyes||Target Version||=> 1.4|
|2014-10-22 17:30||Luca Olivetti||Note Added: 0078529|
|2014-10-22 17:30||Luca Olivetti||Status||resolved => closed|