LCL: Fixed TForm.AutoScroll does not turn off scrollbars if UNCHECKED while scrollbars are showing. Issue #38856

git-svn-id: trunk@65089 -
This commit is contained in:
michl 2021-05-06 20:23:34 +00:00
parent 426f9a5353
commit 5d6cad752d
2 changed files with 23 additions and 1 deletions

View File

@ -160,6 +160,7 @@ type
FIsUpdating: Boolean;
procedure SetHorzScrollBar(Value: TControlScrollBar);
procedure SetVertScrollBar(Value: TControlScrollBar);
procedure HideScrollbars;
protected
class procedure WSRegisterClass; override;
procedure AlignControls(AControl: TControl; var ARect: TRect); override;

View File

@ -13,7 +13,10 @@ procedure TScrollingWinControl.SetAutoScroll(Value: Boolean);
begin
if FAutoScroll = Value then Exit;
FAutoScroll := Value;
UpdateScrollBars;
if Value then
UpdateScrollBars
else
HideScrollbars;
end;
procedure TScrollingWinControl.CreateWnd;
@ -142,6 +145,24 @@ begin
FVertScrollbar.Assign(Value);
end;
procedure TScrollingWinControl.HideScrollbars;
begin
if Assigned(FHorzScrollBar) and FHorzScrollBar.HandleAllocated then
begin
ShowScrollBar(FHorzScrollBar.ControlHandle, SB_Horz, False);
FHorzScrollBar.Range := 0;
FHorzScrollBar.Page := 80;
FHorzScrollBar.Position := 0;
end;
if Assigned(FVertScrollBar) and FVertScrollBar.HandleAllocated then
begin
ShowScrollBar(FVertScrollBar.ControlHandle, SB_Vert, False);
FVertScrollBar.Range := 0;
FVertScrollBar.Page := 80;
FVertScrollBar.Position := 0;
end;
end;
procedure TScrollingWinControl.WMSize(var Message: TLMSize);
var
NewState: TWindowState;