mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 19:59:17 +02:00
LCL: AutoSize=true, no childs, no content, consider AdjustClientRect
git-svn-id: trunk@24440 -
This commit is contained in:
parent
4df6b8b4c4
commit
c89fa706ff
@ -40,7 +40,7 @@ interface
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, TypInfo, LCLStrConsts, LCLType, AvgLvlTree,
|
Classes, SysUtils, TypInfo, types, LCLStrConsts, LCLType, AvgLvlTree,
|
||||||
LCLProc, GraphType, Graphics, LMessages, LCLIntf, InterfaceBase, ImgList,
|
LCLProc, GraphType, Graphics, LMessages, LCLIntf, InterfaceBase, ImgList,
|
||||||
UTrace, PropertyStorage, Menus, ActnList, LCLClasses, LResources;
|
UTrace, PropertyStorage, Menus, ActnList, LCLClasses, LResources;
|
||||||
|
|
||||||
|
@ -7780,10 +7780,11 @@ var
|
|||||||
Layout: TAutoSizeCtrlData;
|
Layout: TAutoSizeCtrlData;
|
||||||
NewClientWidth: Integer;
|
NewClientWidth: Integer;
|
||||||
NewClientHeight: Integer;
|
NewClientHeight: Integer;
|
||||||
OldClientRect: TRect;
|
CurClientRect: TRect;
|
||||||
NewWidth: Integer;
|
NewWidth: Integer;
|
||||||
NewHeight: Integer;
|
NewHeight: Integer;
|
||||||
NewMoveLeft, NewMoveRight: integer;
|
NewMoveLeft, NewMoveRight: integer;
|
||||||
|
AdjustedClientRect: TRect;
|
||||||
begin
|
begin
|
||||||
inherited CalculatePreferredSize(PreferredWidth,PreferredHeight,WithThemeSpace);
|
inherited CalculatePreferredSize(PreferredWidth,PreferredHeight,WithThemeSpace);
|
||||||
|
|
||||||
@ -7796,6 +7797,15 @@ begin
|
|||||||
inc(PreferredHeight,BorderSpacing.InnerBorder*2);
|
inc(PreferredHeight,BorderSpacing.InnerBorder*2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// check AdjustClientRect
|
||||||
|
CurClientRect:=Rect(0,0,1000,1000);
|
||||||
|
AdjustedClientRect:=CurClientRect;
|
||||||
|
AdjustClientRect(AdjustedClientRect);
|
||||||
|
PreferredWidth:=Max(PreferredWidth,
|
||||||
|
AdjustedClientRect.Left+CurClientRect.Right-AdjustedClientRect.Right);
|
||||||
|
PreferredHeight:=Max(PreferredHeight,
|
||||||
|
AdjustedClientRect.Top+CurClientRect.Bottom-AdjustedClientRect.Bottom);
|
||||||
|
|
||||||
if ControlCount>0 then begin
|
if ControlCount>0 then begin
|
||||||
|
|
||||||
// get the size requirements for the child controls
|
// get the size requirements for the child controls
|
||||||
@ -7810,10 +7820,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// add the control border around the client area
|
// add the control border around the client area
|
||||||
OldClientRect := GetClientRect;
|
CurClientRect := GetClientRect;
|
||||||
NewWidth:=Width-OldClientRect.Right+NewClientWidth;
|
NewWidth:=Width-CurClientRect.Right+NewClientWidth;
|
||||||
NewHeight:=Height-OldClientRect.Bottom+NewClientHeight;
|
NewHeight:=Height-CurClientRect.Bottom+NewClientHeight;
|
||||||
|
|
||||||
{$IF defined(VerboseAutoSize) or defined(VerboseAllAutoSize)}
|
{$IF defined(VerboseAutoSize) or defined(VerboseAllAutoSize)}
|
||||||
debugln(['TWinControl.CalculatePreferredSize ',DbgSName(Self),
|
debugln(['TWinControl.CalculatePreferredSize ',DbgSName(Self),
|
||||||
' HandleAllocated=',HandleAllocated,
|
' HandleAllocated=',HandleAllocated,
|
||||||
|
Loading…
Reference in New Issue
Block a user