LCL: TControlScrollBar: fixed considering clientwidth/height and scrollbars visible, bug #16799

git-svn-id: trunk@26567 -
This commit is contained in:
mattias 2010-07-10 07:57:06 +00:00
parent 1e2e275cb5
commit 42463c684d
5 changed files with 15 additions and 18 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;