View Issue Details

IDProjectCategoryView StatusLast Update
0028889LazarusDatabase Componentspublic2016-05-04 10:03
ReporterMichlAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platform32bitOSWindowsOS Version7
Product Version1.5 (SVN)Product Build50105 
Target Version1.8Fixed in Version1.7 (SVN) 
Summary0028889: Last Column in a DBGrid not scrollable
DescriptionIf the width of a column is bigger than the display width of a DBGrid, you can scroll smoth with the mouse to see the entry. It works but not with the last column.
Steps To ReproduceSee attached testproject (with TBufDataset).

The upper DBGrid has two fields, the first ist scrollable, the second not.
The lower DBGrid has one field, what is never scrollable.
Additional InformationThere is a little thread in German Lazarusforum: http://www.lazarusforum.de/viewtopic.php?f=18&t=9119

The behaviour is also in older revisions like Lazarus 1.4.0.
Tagspatch
Fixed in Revision52063
LazTarget1.8
WidgetsetWin32/Win64
Attached Files
  • Test.zip (2,459 bytes)
  • gridscrollfix.pas.patch (694 bytes)
    Index: lcl/grids.pas
    ===================================================================
    --- lcl/grids.pas	(revision 52005)
    +++ lcl/grids.pas	(working copy)
    @@ -4421,7 +4421,7 @@
         aPos := Message.Pos;
     
       with FGCache do begin
    -    TL:=  integer(PtrUInt(AccumWidth[ MaxTopLeft.X ])) - FixedWidth;
    +    TL := GridWidth - ClientWidth;
         CTL:= integer(PtrUInt(AccumWidth[ FTopLeft.X ])) - FixedWidth + TLColOff;
       end;
     
    @@ -4539,7 +4539,7 @@
         exit;
     
       with FGCache do begin
    -    TL:=  integer(PtrUInt(AccumHeight[ MaxTopLeft.Y ])) - FixedHeight;
    +    TL := GridHeight - ClientHeight;
         CTL:= integer(PtrUInt(AccumHeight[ FTopLeft.Y ])) - FixedHeight + TLRowOff;
       end;
     
    
  • Examples.zip (6,808 bytes)
  • gridscrollfix2.pas.patch (824 bytes)
    Index: lcl/grids.pas
    ===================================================================
    --- lcl/grids.pas	(revision 52040)
    +++ lcl/grids.pas	(working copy)
    @@ -4421,7 +4421,7 @@
         aPos := Message.Pos;
     
       with FGCache do begin
    -    TL:=  integer(PtrUInt(AccumWidth[ MaxTopLeft.X ])) - FixedWidth;
    +    TL:=  Max(integer(PtrUInt(AccumWidth[ MaxTopLeft.X ])) - FixedWidth, GridWidth - ClientWidth);
         CTL:= integer(PtrUInt(AccumWidth[ FTopLeft.X ])) - FixedWidth + TLColOff;
       end;
     
    @@ -4539,7 +4539,7 @@
         exit;
     
       with FGCache do begin
    -    TL:=  integer(PtrUInt(AccumHeight[ MaxTopLeft.Y ])) - FixedHeight;
    +    TL:=  Max(integer(PtrUInt(AccumHeight[ MaxTopLeft.Y ])) - FixedHeight, GridHeight - ClientHeight);
         CTL:= integer(PtrUInt(AccumHeight[ FTopLeft.Y ])) - FixedHeight + TLRowOff;
       end;
     
    

Activities

Michl

2015-10-21 11:18

developer  

Test.zip (2,459 bytes)

Michl

2016-03-21 23:54

developer   ~0091266

Last edited: 2016-03-21 23:58

View 2 revisions

Here is a patch that fixes that issue. It works fine for TDBGrids, TStringGrids and TDrawGrids. With it, it is possible to scroll horizontal and vertical as expected.

I also add a example with some different grids to test the behaviour.

Michl

2016-03-21 23:55

developer  

gridscrollfix.pas.patch (694 bytes)
Index: lcl/grids.pas
===================================================================
--- lcl/grids.pas	(revision 52005)
+++ lcl/grids.pas	(working copy)
@@ -4421,7 +4421,7 @@
     aPos := Message.Pos;
 
   with FGCache do begin
-    TL:=  integer(PtrUInt(AccumWidth[ MaxTopLeft.X ])) - FixedWidth;
+    TL := GridWidth - ClientWidth;
     CTL:= integer(PtrUInt(AccumWidth[ FTopLeft.X ])) - FixedWidth + TLColOff;
   end;
 
@@ -4539,7 +4539,7 @@
     exit;
 
   with FGCache do begin
-    TL:=  integer(PtrUInt(AccumHeight[ MaxTopLeft.Y ])) - FixedHeight;
+    TL := GridHeight - ClientHeight;
     CTL:= integer(PtrUInt(AccumHeight[ FTopLeft.Y ])) - FixedHeight + TLRowOff;
   end;
 

Michl

2016-03-21 23:56

developer  

Examples.zip (6,808 bytes)

Jesus Reyes

2016-03-23 19:00

developer   ~0091306

Thanks for the patch, I tested it, when smooth scrolling is enabled all seems to work fine, but when smooth scrolling is disabled some grids in your examples project misbehave, it needs more work. I will be working on this in the next days...

Michl

2016-03-23 20:13

developer   ~0091315

Thank you for your reply!

> I tested it, when smooth scrolling is enabled all seems to work fine, but
> when smooth scrolling is disabled some grids in your examples project
> misbehave, it needs more work.

AFAIK the behaviour of disabled smooth scrolling is the same without the patch. Which issue do you have in eye? Maybe I can test it too.

> I will be working on this in the next days...

Thank you very much!

Jesus Reyes

2016-03-23 21:43

developer   ~0091322

Last edited: 2016-03-23 21:44

View 2 revisions

> AFAIK the behaviour of disabled smooth scrolling is the same without the
> patch. Which issue do you have in eye? Maybe I can test it too.

Recompile your examples project with a patched grid, run and uncheck smoothscroll checkbox.

On the "StringGrids" tab the third and the last grids are not able to scroll to the "end". Dragging the thumb bar to the right or clicking in the empty space at the right of the thumb bar will have no effect. Select any cell on the affected stringgrids and press the RIGHT ARROW key until the end location, the thumb bar will be positioned at the rightmost position.

Michl

2016-03-24 08:01

developer   ~0091328

Last edited: 2016-03-24 08:13

View 2 revisions

Thanks for your hints! I see what you describe.

[Edit]
I just debug the code. I think the solution is very simple. I've added a new patch gridscrollfix2.pas.patch.

But you are the specialist, maybe there is a better solution.

Michl

2016-03-24 08:10

developer  

gridscrollfix2.pas.patch (824 bytes)
Index: lcl/grids.pas
===================================================================
--- lcl/grids.pas	(revision 52040)
+++ lcl/grids.pas	(working copy)
@@ -4421,7 +4421,7 @@
     aPos := Message.Pos;
 
   with FGCache do begin
-    TL:=  integer(PtrUInt(AccumWidth[ MaxTopLeft.X ])) - FixedWidth;
+    TL:=  Max(integer(PtrUInt(AccumWidth[ MaxTopLeft.X ])) - FixedWidth, GridWidth - ClientWidth);
     CTL:= integer(PtrUInt(AccumWidth[ FTopLeft.X ])) - FixedWidth + TLColOff;
   end;
 
@@ -4539,7 +4539,7 @@
     exit;
 
   with FGCache do begin
-    TL:=  integer(PtrUInt(AccumHeight[ MaxTopLeft.Y ])) - FixedHeight;
+    TL:=  Max(integer(PtrUInt(AccumHeight[ MaxTopLeft.Y ])) - FixedHeight, GridHeight - ClientHeight);
     CTL:= integer(PtrUInt(AccumHeight[ FTopLeft.Y ])) - FixedHeight + TLRowOff;
   end;
 

Jesus Reyes

2016-03-26 18:29

developer   ~0091430

It looks ok to me, patch applied thank you.

It should be tested for a while before merging it to stable.

Issue History

Date Modified Username Field Change
2015-10-21 11:18 Michl New Issue
2015-10-21 11:18 Michl File Added: Test.zip
2016-03-21 23:54 Michl Note Added: 0091266
2016-03-21 23:54 Michl File Added: gridscrollfix.pas
2016-03-21 23:55 Michl File Added: gridscrollfix.pas.patch
2016-03-21 23:56 Michl File Added: Examples.zip
2016-03-21 23:58 Michl Note Edited: 0091266 View Revisions
2016-03-21 23:58 Michl Tag Attached: patch
2016-03-22 18:45 Jesus Reyes Assigned To => Jesus Reyes
2016-03-22 18:45 Jesus Reyes Status new => assigned
2016-03-23 00:02 Jesus Reyes File Deleted: gridscrollfix.pas
2016-03-23 19:00 Jesus Reyes Note Added: 0091306
2016-03-23 20:13 Michl Note Added: 0091315
2016-03-23 21:43 Jesus Reyes Note Added: 0091322
2016-03-23 21:44 Jesus Reyes Note Edited: 0091322 View Revisions
2016-03-24 08:01 Michl Note Added: 0091328
2016-03-24 08:10 Michl File Added: gridscrollfix2.pas.patch
2016-03-24 08:13 Michl Note Edited: 0091328 View Revisions
2016-03-26 18:29 Jesus Reyes Fixed in Revision => 52063
2016-03-26 18:29 Jesus Reyes LazTarget => 1.8
2016-03-26 18:29 Jesus Reyes Note Added: 0091430
2016-03-26 18:29 Jesus Reyes Status assigned => resolved
2016-03-26 18:29 Jesus Reyes Fixed in Version => 1.7 (SVN)
2016-03-26 18:29 Jesus Reyes Resolution open => fixed
2016-03-26 18:29 Jesus Reyes Target Version => 1.8
2016-05-04 10:03 Michl Status resolved => closed