View Issue Details

IDProjectCategoryView StatusLast Update
0035472LazarusLCLpublic2019-10-11 12:27
ReporterPavol SAssigned Towp 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionreopened 
Product Version2.0Product Build60307 
Target VersionFixed in Version 
Summary0035472: TStringGrid/TDrawGrid horizontal scrollbar bug after form maximize
DescriptionHorizontal scrollbar is still visible at wrong position after form maximzed and scrollbar is no longer needed.

Platform:Windows 10.
Steps To Reproduce1. Place TStringGrid on form
2. set aling alClient
3. set ColCount at least 12 (or until Horizontal scrollbar is visible)
(don't add rows)
Run app and scroll with scrollbar to right (at least 1px). Maximize form. -> Scrollbar is in original position.
Additional InformationFix:

lcl\grids.pas:

procedure TCustomGrid.UpdateHorzScrollBar(const aVisible: boolean;
  const aRange,aPage,aPos: Integer);
var
  NeedUpdate: Boolean;
begin
  {$ifdef DbgScroll}
  DebugLn('TCustomGrid.UpdateHorzScrollbar: Vis=%s Range=%d Page=%d aPos=%d',
    [dbgs(aVisible),aRange, aPage, aPos]);
  {$endif}
  NeedUpdate := FHSbVisible<>Ord(aVisible);
  if NeedUpdate then
    ScrollBarShow(SB_HORZ, aVisible);
  if aVisible or NeedUpdate then
    ScrollBarRange(SB_HORZ, aRange, aPage, aPos);
{ original code here
  if FHSbVisible<>Ord(aVisible) then
    ScrollBarShow(SB_HORZ, aVisible);
  if aVisible then
    ScrollBarRange(SB_HORZ, aRange, aPage, aPos);
}
end;
TagsStringGrid, TDrawGrid, TStringGird
Fixed in Revisionr62031
LazTarget2.0.6
WidgetsetWin32/Win64
Attached Files
  • form-before.png (6,340 bytes)
    form-before.png (6,340 bytes)
  • form-maximizded.png (9,421 bytes)
    form-maximizded.png (9,421 bytes)
  • 35472-patch.diff (846 bytes)
    Index: C:/development/svnlazarus/lazarus/lcl/grids.pas
    ===================================================================
    --- C:/development/svnlazarus/lazarus/lcl/grids.pas	(revision 61998)
    +++ C:/development/svnlazarus/lazarus/lcl/grids.pas	(working copy)
    @@ -7932,14 +7932,17 @@
     
     procedure TCustomGrid.UpdateHorzScrollBar(const aVisible: boolean;
       const aRange,aPage,aPos: Integer);
    +var
    +  NeedUpdate: Boolean;
     begin
       {$ifdef DbgScroll}
       DebugLn('TCustomGrid.UpdateHorzScrollbar: Vis=%s Range=%d Page=%d aPos=%d',
         [dbgs(aVisible),aRange, aPage, aPos]);
       {$endif}
    -  if FHSbVisible<>Ord(aVisible) then
    +  NeedUpdate := FHSbVisible<>Ord(aVisible);
    +  if NeedUpdate then
         ScrollBarShow(SB_HORZ, aVisible);
    -  if aVisible then
    +  if aVisible or NeedUpdate then
         ScrollBarRange(SB_HORZ, aRange, aPage, aPos);
     end;
     
    
    35472-patch.diff (846 bytes)

Activities

Pavol S

2019-04-30 13:32

reporter  

form-before.png (6,340 bytes)
form-before.png (6,340 bytes)
form-maximizded.png (9,421 bytes)
form-maximizded.png (9,421 bytes)

Pavol S

2019-10-08 07:55

reporter   ~0118402

Added patch as file.

35472-patch.diff (846 bytes)
Index: C:/development/svnlazarus/lazarus/lcl/grids.pas
===================================================================
--- C:/development/svnlazarus/lazarus/lcl/grids.pas	(revision 61998)
+++ C:/development/svnlazarus/lazarus/lcl/grids.pas	(working copy)
@@ -7932,14 +7932,17 @@
 
 procedure TCustomGrid.UpdateHorzScrollBar(const aVisible: boolean;
   const aRange,aPage,aPos: Integer);
+var
+  NeedUpdate: Boolean;
 begin
   {$ifdef DbgScroll}
   DebugLn('TCustomGrid.UpdateHorzScrollbar: Vis=%s Range=%d Page=%d aPos=%d',
     [dbgs(aVisible),aRange, aPage, aPos]);
   {$endif}
-  if FHSbVisible<>Ord(aVisible) then
+  NeedUpdate := FHSbVisible<>Ord(aVisible);
+  if NeedUpdate then
     ScrollBarShow(SB_HORZ, aVisible);
-  if aVisible then
+  if aVisible or NeedUpdate then
     ScrollBarRange(SB_HORZ, aRange, aPage, aPos);
 end;
 
35472-patch.diff (846 bytes)

wp

2019-10-11 12:23

developer   ~0118492

Applied your patch. Please test and close if ok.

Issue History

Date Modified Username Field Change
2019-04-30 13:32 Pavol S New Issue
2019-04-30 13:32 Pavol S File Added: form-before.png
2019-04-30 13:32 Pavol S File Added: form-maximizded.png
2019-04-30 13:35 Pavol S Tag Attached: StringGrid
2019-04-30 13:35 Pavol S Tag Attached: TStringGird
2019-04-30 13:35 Pavol S Tag Attached: TDrawGrid
2019-05-03 03:10 Jesus Reyes Assigned To => Jesus Reyes
2019-05-03 03:10 Jesus Reyes Status new => assigned
2019-10-08 07:55 Pavol S File Added: 35472-patch.diff
2019-10-08 07:55 Pavol S Note Added: 0118402
2019-10-11 12:23 wp Assigned To Jesus Reyes => wp
2019-10-11 12:23 wp Status assigned => resolved
2019-10-11 12:23 wp Resolution open => fixed
2019-10-11 12:23 wp Fixed in Revision => r62031
2019-10-11 12:23 wp LazTarget => 2.2
2019-10-11 12:23 wp Widgetset Win32/Win64 => Win32/Win64
2019-10-11 12:23 wp Note Added: 0118492
2019-10-11 12:27 wp Status resolved => assigned
2019-10-11 12:27 wp Resolution fixed => reopened
2019-10-11 12:27 wp LazTarget 2.2 => 2.0.6
2019-10-11 12:27 wp Status assigned => resolved
2019-10-11 12:27 wp Widgetset Win32/Win64 => Win32/Win64