View Issue Details

IDProjectCategoryView StatusLast Update
0017586LazarusLCLpublic2010-10-09 22:18
ReporterDenis GolovanAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version0.9.28.3 (SVN)Product Build 
Target VersionFixed in Version0.9.29 (SVN) 
Summary0017586: [Regression] DbGrid lookup field stop working
DescriptionHi

The problem is common for all widgetsets.
I assume something changed during last couple months in DbGrid functionality.
Now the problem looks like:
-I try to attach PickList for some column.
-Dropdown editor works fine except that is neither applies changes of such column to existing records in grid, nor creates a new record when starting to edit lookup field first.
-The problem symptom is TCustomGrid.UpdateData method gets FEditingColumn=-1 and/or FDatalink.Editing=false

See testcase attached.
My cruel hack solves the problem.
TagsNo tags attached.
Fixed in Revision27636
LazTarget0.9.30
Widgetset
Attached Files
  • dbgrid.patch (959 bytes)
    diff --git a/lcl/dbgrids.pas b/lcl/dbgrids.pas
    index 615c6e4..b17febb 100644
    --- a/lcl/dbgrids.pas
    +++ b/lcl/dbgrids.pas
    @@ -373,6 +373,7 @@ type
         procedure DefaultDrawCell(aCol,aRow: Integer; aRect: TRect; aState: TGridDrawState);
         function  DefaultEditorStyle(const Style:TColumnButtonStyle; const F:TField): TColumnButtonStyle;
         procedure DoExit; override;
    +    procedure DoEditorShow; override;
         function  DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
         function  DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
         procedure DoOnChangeBounds; override;
    @@ -2426,6 +2427,13 @@ begin
       {$ifdef dbgDBGrid}DebugLn('DBGrid.DoExit FIN');{$Endif}
     end;
     
    +procedure TCustomDBGrid.DoEditorShow;
    +begin
    +  inherited DoEditorShow;
    +  FDataLink.Edit;
    +  EditingColumn( Col, true );
    +end;
    +
     function TCustomDBGrid.DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint
       ): Boolean;
     begin
    
    dbgrid.patch (959 bytes)
  • DbGridLookup.tar.gz (24,814 bytes)

Activities

2010-10-09 13:07

 

dbgrid.patch (959 bytes)
diff --git a/lcl/dbgrids.pas b/lcl/dbgrids.pas
index 615c6e4..b17febb 100644
--- a/lcl/dbgrids.pas
+++ b/lcl/dbgrids.pas
@@ -373,6 +373,7 @@ type
     procedure DefaultDrawCell(aCol,aRow: Integer; aRect: TRect; aState: TGridDrawState);
     function  DefaultEditorStyle(const Style:TColumnButtonStyle; const F:TField): TColumnButtonStyle;
     procedure DoExit; override;
+    procedure DoEditorShow; override;
     function  DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
     function  DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
     procedure DoOnChangeBounds; override;
@@ -2426,6 +2427,13 @@ begin
   {$ifdef dbgDBGrid}DebugLn('DBGrid.DoExit FIN');{$Endif}
 end;
 
+procedure TCustomDBGrid.DoEditorShow;
+begin
+  inherited DoEditorShow;
+  FDataLink.Edit;
+  EditingColumn( Col, true );
+end;
+
 function TCustomDBGrid.DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint
   ): Boolean;
 begin
dbgrid.patch (959 bytes)

2010-10-09 13:07

 

DbGridLookup.tar.gz (24,814 bytes)

Denis Golovan

2010-10-09 13:10

reporter   ~0041646

Last edited: 2010-10-09 20:13

Forgot to mention - tested in svn rev.27611, the patch is against the same revision.
Unfortunately my hack does not work under win32, under gtk2 it does though.

Jesus Reyes

2010-10-09 20:34

developer   ~0041662

Please test under windows, I've tested under gtk2.

Denis Golovan

2010-10-09 22:18

reporter   ~0041667

Nice working fast bugfix! It works under win32 as well.
I love that :)
Thanks

Issue History

Date Modified Username Field Change
2010-10-09 13:07 Denis Golovan New Issue
2010-10-09 13:07 Denis Golovan File Added: dbgrid.patch
2010-10-09 13:07 Denis Golovan File Added: DbGridLookup.tar.gz
2010-10-09 13:10 Denis Golovan Note Added: 0041646
2010-10-09 15:49 Maxim Ganetsky LazTarget => 0.9.30
2010-10-09 18:36 Jesus Reyes Status new => assigned
2010-10-09 18:36 Jesus Reyes Assigned To => Jesus Reyes
2010-10-09 20:13 Denis Golovan Note Edited: 0041646
2010-10-09 20:34 Jesus Reyes Fixed in Revision => 27636
2010-10-09 20:34 Jesus Reyes Status assigned => resolved
2010-10-09 20:34 Jesus Reyes Fixed in Version => 0.9.29 (SVN)
2010-10-09 20:34 Jesus Reyes Resolution open => fixed
2010-10-09 20:34 Jesus Reyes Note Added: 0041662
2010-10-09 22:18 Denis Golovan Status resolved => closed
2010-10-09 22:18 Denis Golovan Note Added: 0041667