Skip to content
GitLab
    • Why GitLab
    • Pricing
    • Contact Sales
    • Explore
  • Why GitLab
  • Pricing
  • Contact Sales
  • Explore
  • Sign in
  • Get free trial
  • FPC
  • LazarusLazarus
  • LazarusLazarus
  • Issues
  • #35472

TStringGrid/TDrawGrid horizontal scrollbar bug after form maximize

Original Reporter info from Mantis: ps
  • Reporter name: Pavol S

Description:

Horizontal scrollbar is still visible at wrong position after form maximzed and scrollbar is no longer needed.

Platform:Windows 10.

Steps to reproduce:

  1. 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 information:

Fix:

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;   

Mantis conversion info:

  • Mantis ID: 35472
  • Build: 60307
  • Version: 2.0
  • Fixed in revision: r62031 (#9cad1b3f)
  • Target version: 2.0.6
Assignee
Assign to
Time tracking