LCL: enabled autosize for controls without parent, TForm will not autosize if minimized/maximized, once painted

git-svn-id: trunk@12483 -
This commit is contained in:
mattias 2007-10-15 23:30:39 +00:00
parent 2a5042eef4
commit 029946b537
4 changed files with 13 additions and 4 deletions

View File

@ -6088,7 +6088,7 @@ begin
with ButtonPanel do begin
Name:='ButtonPanel';
Align:=alBottom;
Anchors:=Anchors-[akTop];
AnchorToNeighbour(akTop,0,Edit1);
AutoSize:=true;
BevelOuter:=bvNone;
Caption:='';

View File

@ -336,7 +336,8 @@ type
fsCreatedMDIChild,
fsBorderStyleChanged,
fsFormStyleChanged,
fsFirstShow // form is shown for the first time
fsFirstShow, // form is shown for the first time
fsDisableAutoSize
);
TFormState = set of TFormStateType;
@ -466,6 +467,7 @@ type
function VisibleIsStored: boolean;
function ColorIsStored: boolean; override;
procedure DoSendBoundsToInterface; override;
procedure DoAutoSize; override;
class function GetControlClassDefaultSize: TPoint; override;
protected
// drag and dock

View File

@ -519,6 +519,7 @@ end;
procedure TCustomForm.WMPaint(var Message: TLMPaint);
begin
//DebugLn('[TCustomForm.WMPaint] ',Name,':',ClassName);
Include(FFormState,fsDisableAutoSize);
inherited WMPaint(Message);
//DebugLn('[TCustomForm.WMPaint] END ',Name,':',ClassName);
end;
@ -971,6 +972,12 @@ begin
end;
end;
procedure TCustomForm.DoAutoSize;
begin
if (WindowState=wsNormal) and (not (fsDisableAutoSize in FFormState)) then
inherited DoAutoSize;
end;
class function TCustomForm.GetControlClassDefaultSize: TPoint;
begin
Result.X:=320;

View File

@ -2728,7 +2728,7 @@ var
function WidthDependsOnParent: boolean;
begin
if Parent=nil then
Result:=true // top level controls depend on the window manager
Result:=false
else
Result:=Parent.ChildSizing.Layout<>cclNone;
end;
@ -2749,7 +2749,7 @@ var
function HeightDependsOnParent: boolean;
begin
if Parent=nil then
Result:=true // top level controls depend on the window manager
Result:=false
else
Result:=Parent.ChildSizing.Layout<>cclNone;
end;