mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 07:38:14 +02:00
LCL: TControlScrollBar: fixed considering clientwidth/height and scrollbars visible, bug #16799
git-svn-id: trunk@26567 -
This commit is contained in:
parent
1e2e275cb5
commit
42463c684d
@ -137,6 +137,7 @@ type
|
||||
property Kind: TScrollBarKind read FKind;
|
||||
function GetOtherScrollBar: TControlScrollBar;
|
||||
property Size: integer read GetSize write SetSize stored False;
|
||||
function ClientSize: integer; // return for vertical scrollbar the clientwidth
|
||||
function ClientSizeWithBar: integer; // return for vertical scrollbar the clientwidth with the bar, even if Visible=false
|
||||
function ClientSizeWithoutBar: integer; // return for vertical scrollbar the clientwidth without the bar, even if Visible=true
|
||||
published
|
||||
|
@ -287,7 +287,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
inherited WSSetText(AText);
|
||||
//DebugLn(['TCustomButton.WSSetText ',dbgsName(Self),' Caption="',Caption,'" AutoSizeCanStart=',AutoSizeCanStart,' AutoSizeDelayed=',AutoSizeDelayed]);
|
||||
//DebugLn(['TCustomButton.WSSetText ',dbgsName(Self),' Caption="',Caption,'"]);
|
||||
end;
|
||||
|
||||
procedure TCustomButton.TextChanged;
|
||||
|
@ -490,22 +490,24 @@ begin
|
||||
Result := GetVertSCrollbar;
|
||||
end;
|
||||
|
||||
function TControlScrollBar.ClientSizeWithBar: integer;
|
||||
function TControlScrollBar.ClientSize: integer;
|
||||
begin
|
||||
if Kind = sbVertical then
|
||||
Result:=FControl.ClientWidth
|
||||
else
|
||||
Result:=FControl.ClientHeight;
|
||||
end;
|
||||
|
||||
function TControlScrollBar.ClientSizeWithBar: integer;
|
||||
begin
|
||||
Result:=ClientSize;
|
||||
if not Visible then
|
||||
dec(Result,GetSize);
|
||||
end;
|
||||
|
||||
function TControlScrollBar.ClientSizeWithoutBar: integer;
|
||||
begin
|
||||
if Kind = sbVertical then
|
||||
Result:=FControl.ClientWidth
|
||||
else
|
||||
Result:=FControl.ClientHeight;
|
||||
Result:=ClientSize;
|
||||
if Visible then
|
||||
inc(Result,GetSize);
|
||||
end;
|
||||
|
@ -121,14 +121,7 @@ function TScrollingWinControl.ComputeScrollbars: Boolean;
|
||||
OldAutoRange := p_Bar.FAutoRange;
|
||||
p_Bar.FAutoRange := 0;
|
||||
OtherScrollbar := p_Bar.GetOtherScrollBar;
|
||||
if OtherScrollbar.FVisible then
|
||||
SBSize := OtherScrollbar.Size
|
||||
else
|
||||
SBSize := 0;
|
||||
if p_Bar.Kind = sbVertical then
|
||||
SBSize := ClientHeight - SBSize
|
||||
else
|
||||
SBSize := ClientWidth - SBSize;
|
||||
SBSize := OtherScrollbar.ClientSize;
|
||||
if (p_Bar.FRange > SBSize) and (SBSize > 0) then
|
||||
p_Bar.FAutoRange := (p_Bar.FRange - SBSize)
|
||||
else
|
||||
@ -145,14 +138,15 @@ var
|
||||
NewPage: Integer;
|
||||
begin
|
||||
Result := False;
|
||||
// page
|
||||
NewPage := Max(1,Min(ClientWidth - 1, High(HorzScrollbar.FPage)));
|
||||
|
||||
// page (must be smaller than Range and at least 1)
|
||||
NewPage := Max(1,Min(VertScrollbar.ClientSize - 1, High(HorzScrollbar.FPage)));
|
||||
if NewPage <> HorzScrollbar.FPage then
|
||||
begin
|
||||
HorzScrollbar.FPage := NewPage;
|
||||
Result := True;
|
||||
end;
|
||||
NewPage := Max(1,Min(ClientHeight - 1, High(VertScrollbar.FPage)));
|
||||
NewPage := Max(1,Min(HorzScrollbar.ClientSize - 1, High(VertScrollbar.FPage)));
|
||||
if NewPage <> VertScrollbar.FPage then
|
||||
begin
|
||||
VertScrollbar.FPage := NewPage;
|
||||
|
@ -3292,7 +3292,7 @@ begin
|
||||
{$ENDIF}
|
||||
if not (caspComputingBounds in AutoSizePhases) then begin
|
||||
{$IFDEF VerboseAllAutoSize}
|
||||
DebugLn(['TWinControl.DoAutoSize DELAYED AutoSizeCanStart=',AutoSizeCanStart,' AutoSizeDelayed=',AutoSizeDelayed,' AutoSizePhase=',AutoSizePhaseNames[AutoSizePhase]]);
|
||||
DebugLn(['TWinControl.DoAutoSize DELAYED AutoSizePhase=',AutoSizePhaseNames[AutoSizePhase]]);
|
||||
{$ENDIF}
|
||||
Include(FControlFlags,cfAutoSizeNeeded);
|
||||
exit;
|
||||
|
Loading…
Reference in New Issue
Block a user