lcl: fix some autosize problems

git-svn-id: trunk@18501 -
This commit is contained in:
paul 2009-01-30 07:44:06 +00:00
parent 2927d73fba
commit 983e3633ec
5 changed files with 13 additions and 11 deletions

View File

@ -57,7 +57,6 @@ end;
procedure TCustomPanel.UpdateBordersAndBevels; procedure TCustomPanel.UpdateBordersAndBevels;
begin begin
InvalidateClientRectCache(True);
DoAdjustClientRectChange; DoAdjustClientRectChange;
Invalidate; Invalidate;
end; end;

View File

@ -3312,19 +3312,22 @@ end;
and calls AlignControl(nil) on change. and calls AlignControl(nil) on change.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TWinControl.DoAdjustClientRectChange; procedure TWinControl.DoAdjustClientRectChange;
var r: TRect; var
R: TRect;
begin begin
r:=GetClientRect; InvalidateClientRectCache(True);
AdjustClientRect(r); R := GetClientRect;
AdjustClientRect(R);
//DebugLn(['TWinControl.DoAdjustClientRectChange ',DbgSName(Self),' ',r.Right,',',r.Bottom,' ',CompareRect(@r,@FAdjustClientRectRealized)]); //DebugLn(['TWinControl.DoAdjustClientRectChange ',DbgSName(Self),' ',r.Right,',',r.Bottom,' ',CompareRect(@r,@FAdjustClientRectRealized)]);
if not CompareRect(@r,@FAdjustClientRectRealized) then begin if not CompareRect(@R, @FAdjustClientRectRealized) then
begin
// client rect changed since last AlignControl // client rect changed since last AlignControl
{$IFDEF VerboseClientRectBugFix} {$IFDEF VerboseClientRectBugFix}
DebugLn('UUU TWinControl.DoAdjustClientRectChange ClientRect changed ',Name,':',ClassName, DebugLn('UUU TWinControl.DoAdjustClientRectChange ClientRect changed ',Name,':',ClassName,
' Old=',Dbgs(FAdjustClientRectRealized.Right),'x',DbgS(FAdjustClientRectRealized.Bottom), ' Old=',Dbgs(FAdjustClientRectRealized.Right),'x',DbgS(FAdjustClientRectRealized.Bottom),
' New=',DbgS(r.Right),'x',DbgS(r.Bottom)); ' New=',DbgS(r.Right),'x',DbgS(r.Bottom));
{$ENDIF} {$ENDIF}
FAdjustClientRectRealized:=r; FAdjustClientRectRealized := R;
ReAlign; ReAlign;
Resize; Resize;
AdjustSize; AdjustSize;
@ -6215,7 +6218,7 @@ begin
{$ENDIF} {$ENDIF}
NewLeft:=Left; NewLeft:=Left;
NewTop:=Top; NewTop:=Top;
if (Message.SizeType and Size_SourceIsInterface)>0 then if (Message.SizeType and Size_SourceIsInterface) > 0 then
begin begin
// interface widget has resized // interface widget has resized
// -> update position and realized bounds // -> update position and realized bounds
@ -6234,6 +6237,10 @@ begin
SetBoundsKeepBase(NewLeft,NewTop,Message.Width,Message.Height,Parent<>nil); SetBoundsKeepBase(NewLeft,NewTop,Message.Width,Message.Height,Parent<>nil);
if ClientRectNeedsInterfaceUpdate then if ClientRectNeedsInterfaceUpdate then
DoAdjustClientRectChange; DoAdjustClientRectChange;
if ((Message.SizeType and Size_SourceIsInterface) > 0) and
(Parent <> nil) and Parent.AutoSize then
Parent.AdjustSize;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -6567,7 +6574,6 @@ begin
//debugln('TWinControl.CreateWnd ',DbgSName(Self)); //debugln('TWinControl.CreateWnd ',DbgSName(Self));
Constraints.UpdateInterfaceConstraints; Constraints.UpdateInterfaceConstraints;
InvalidateClientRectCache(False); InvalidateClientRectCache(False);
InvalidatePreferredSize;
TWSWinControlClass(WidgetSetClass).ConstraintsChange(Self); TWSWinControlClass(WidgetSetClass).ConstraintsChange(Self);
//WriteClientRect('A'); //WriteClientRect('A');

View File

@ -2505,7 +2505,6 @@ begin
if (NewSize.cx <> LCLObject.Width) or (NewSize.cy <> LCLObject.Height) or if (NewSize.cx <> LCLObject.Width) or (NewSize.cy <> LCLObject.Height) or
(LCLObject.ClientRectNeedsInterfaceUpdate) then (LCLObject.ClientRectNeedsInterfaceUpdate) then
begin begin
LCLObject.InvalidateClientRectCache(true);
LCLObject.DoAdjustClientRectChange; LCLObject.DoAdjustClientRectChange;
end; end;

View File

@ -2343,7 +2343,6 @@ begin
if (lWinControl.Width<>Width) or (lWinControl.Height<>Height) if (lWinControl.Width<>Width) or (lWinControl.Height<>Height)
or lWinControl.ClientRectNeedsInterfaceUpdate then or lWinControl.ClientRectNeedsInterfaceUpdate then
begin begin
lWinControl.InvalidateClientRectCache(true);
lWinControl.DoAdjustClientRectChange; lWinControl.DoAdjustClientRectChange;
if (lWinControl is TCustomPage) if (lWinControl is TCustomPage)
and (lWinControl.Parent is TCustomNotebook) then and (lWinControl.Parent is TCustomNotebook) then

View File

@ -1976,7 +1976,6 @@ begin
if (lWinControl.Width<>Width) or (lWinControl.Height<>Height) if (lWinControl.Width<>Width) or (lWinControl.Height<>Height)
or lWinControl.ClientRectNeedsInterfaceUpdate then or lWinControl.ClientRectNeedsInterfaceUpdate then
begin begin
lWinControl.InvalidateClientRectCache(true);
lWinControl.DoAdjustClientRectChange; lWinControl.DoAdjustClientRectChange;
if (lWinControl is TCustomPage) if (lWinControl is TCustomPage)
and (lWinControl.Parent is TCustomNotebook) then and (lWinControl.Parent is TCustomNotebook) then