View Issue Details

IDProjectCategoryView StatusLast Update
0029261LazarusLCLpublic2015-12-31 09:51
Reporterabonic1Assigned ToOndrej Pokorny 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.6RC1Product Build 
Target Version1.6Fixed in Version1.7 (SVN) 
Summary0029261: Wrong value posted to dataset after cancelling edit by Esc-key in DbGrid
DescriptionUnder certain conditions, Esc-key will will only seemingly undo changes in the DbGrid. But in the linked dataset will be posted different value, the one that was before 'Esc'.
Steps To Reproduce1. Start attached demo.
2. Change value in the first cell from '1' to '100' and then press 'Esc' once. Changes are canceled and cell value is reverted to '1', as expected.
3. Press Down key (or initiate Post on some other way). The value in the first cell (and in the dataset) is now '100'.
Additional InformationDemo use TMemDataset, but the same thing happens with TSqlQuery or TZQuery.
TagsNo tags attached.
Fixed in Revision51088
LazTarget1.6
Widgetset
Attached Files
  • test dbgrid.zip (3,749 bytes)
  • grids.pas.patch (585 bytes)
    Index: lcl/grids.pas
    ===================================================================
    --- lcl/grids.pas	(revision 2)
    +++ lcl/grids.pas	(working copy)
    @@ -9613,7 +9613,10 @@
         VK_END, VK_HOME:
           ;
         VK_ESCAPE:
    -      FGrid.EditorHide;
    +      begin
    +        doGridKeyDown;
    +        FGrid.EditorHide;
    +      end
         else
           doEditorKeyDown;
       end;
    @@ -12233,7 +12236,10 @@
         VK_END, VK_HOME:
           ;
         VK_ESCAPE:
    -      FGrid.EditorHide;
    +      begin
    +        doGridKeyDown;
    +        FGrid.EditorHide;
    +      end
         else
           doEditorKeyDown;
       end;
    
    grids.pas.patch (585 bytes)
  • new.grids.pas.patch (587 bytes)
    Index: lcl/grids.pas
    ===================================================================
    --- lcl/grids.pas	(revision 2)
    +++ lcl/grids.pas	(working copy)
    @@ -9613,7 +9613,10 @@
         VK_END, VK_HOME:
           ;
         VK_ESCAPE:
    -      FGrid.EditorHide;
    +      begin
    +        doGridKeyDown;
    +        FGrid.EditorHide;
    +      end;
         else
           doEditorKeyDown;
       end;
    @@ -12233,7 +12236,10 @@
         VK_END, VK_HOME:
           ;
         VK_ESCAPE:
    -      FGrid.EditorHide;
    +      begin
    +        doGridKeyDown;
    +        FGrid.EditorHide;
    +      end;
         else
           doEditorKeyDown;
       end;
    
    new.grids.pas.patch (587 bytes)

Activities

abonic1

2015-12-27 11:52

reporter  

test dbgrid.zip (3,749 bytes)

Michl

2015-12-28 22:21

developer   ~0088374

I can confirm that issue (tested with TBufDataSet - testproject from here 0029243). It comes with revision 50872.

abonic1

2015-12-30 16:08

reporter  

grids.pas.patch (585 bytes)
Index: lcl/grids.pas
===================================================================
--- lcl/grids.pas	(revision 2)
+++ lcl/grids.pas	(working copy)
@@ -9613,7 +9613,10 @@
     VK_END, VK_HOME:
       ;
     VK_ESCAPE:
-      FGrid.EditorHide;
+      begin
+        doGridKeyDown;
+        FGrid.EditorHide;
+      end
     else
       doEditorKeyDown;
   end;
@@ -12233,7 +12236,10 @@
     VK_END, VK_HOME:
       ;
     VK_ESCAPE:
-      FGrid.EditorHide;
+      begin
+        doGridKeyDown;
+        FGrid.EditorHide;
+      end
     else
       doEditorKeyDown;
   end;
grids.pas.patch (585 bytes)

abonic1

2015-12-30 16:09

reporter   ~0088437

Last edited: 2015-12-30 20:29

View 2 revisions

Possible fix in 'new.grids.pas.patch'.

abonic1

2015-12-30 20:29

reporter  

new.grids.pas.patch (587 bytes)
Index: lcl/grids.pas
===================================================================
--- lcl/grids.pas	(revision 2)
+++ lcl/grids.pas	(working copy)
@@ -9613,7 +9613,10 @@
     VK_END, VK_HOME:
       ;
     VK_ESCAPE:
-      FGrid.EditorHide;
+      begin
+        doGridKeyDown;
+        FGrid.EditorHide;
+      end;
     else
       doEditorKeyDown;
   end;
@@ -12233,7 +12236,10 @@
     VK_END, VK_HOME:
       ;
     VK_ESCAPE:
-      FGrid.EditorHide;
+      begin
+        doGridKeyDown;
+        FGrid.EditorHide;
+      end;
     else
       doEditorKeyDown;
   end;
new.grids.pas.patch (587 bytes)

Ondrej Pokorny

2015-12-31 09:23

developer   ~0088453

Applied, thanks.

Issue History

Date Modified Username Field Change
2015-12-27 11:52 abonic1 New Issue
2015-12-27 11:52 abonic1 File Added: test dbgrid.zip
2015-12-28 22:21 Michl Note Added: 0088374
2015-12-30 16:08 abonic1 File Added: grids.pas.patch
2015-12-30 16:09 abonic1 Note Added: 0088437
2015-12-30 20:29 abonic1 File Added: new.grids.pas.patch
2015-12-30 20:29 abonic1 Note Edited: 0088437 View Revisions
2015-12-30 23:45 Ondrej Pokorny Assigned To => Ondrej Pokorny
2015-12-30 23:45 Ondrej Pokorny Status new => assigned
2015-12-31 09:23 Ondrej Pokorny Fixed in Revision => 51088
2015-12-31 09:23 Ondrej Pokorny LazTarget => 1.6
2015-12-31 09:23 Ondrej Pokorny Note Added: 0088453
2015-12-31 09:23 Ondrej Pokorny Status assigned => resolved
2015-12-31 09:23 Ondrej Pokorny Fixed in Version => 1.7 (SVN)
2015-12-31 09:23 Ondrej Pokorny Resolution open => fixed
2015-12-31 09:23 Ondrej Pokorny Target Version => 1.6
2015-12-31 09:51 abonic1 Status resolved => closed