LCL: TLabel: do not change size in DoAutoSize, TWinControl.CreateWnd: invalidatepreferredszie of childs - needed for non TWinControl

git-svn-id: trunk@24263 -
This commit is contained in:
mattias 2010-03-28 11:53:08 +00:00
parent ed6915b885
commit 1ee2beda9e
3 changed files with 21 additions and 8 deletions

View File

@ -476,10 +476,9 @@ begin
BoundsOutOfBounds;
{$IFDEF CHECK_POSITION}
if CheckPosition(Self) then
DebugLn('TControl.DoSetBounds ',Name,':',ClassName,
' Old=',DbgS(Left,Top,Width,Height),
' New=',DbgS(aLeft,aTop,aWidth,aHeight),
'');
DebugLn(['TControl.DoSetBounds ',DbgSName(Self),
' Old=',Left,',',Top,',',Width,'x',Height,
' New=',aLeft,',',aTop,',',aWidth,'x',aHeight]);
{$ENDIF}
FLeft := ALeft;
FTop := ATop;

View File

@ -80,18 +80,21 @@ begin
end;
procedure TCustomLabel.DoAutoSize;
{$IFDEF OldAutoSize}
var
NewWidth, NewHeight: integer;
CurAnchors: TAnchors;
{$ENDIF}
begin
inherited DoAutoSize;
//debugln('TCustomLabel.DoAutoSize ',DbgSName(Self),' AutoSizing=',dbgs(AutoSizing),' AutoSize=',dbgs(AutoSize),' Parent=',DbgSName(Parent),' csLoading=',dbgs(csLoading in ComponentState),' Parnet.HandleAllocated=',dbgs((Parent<>nil) and (Parent.HandleAllocated)));
{$IFDEF OldAutoSize}
if OptimalFill and (not AutoSize) then
begin
AdjustFontForOptimalFill;
Exit;
end;
if AutoSizeDelayed then
Exit;
@ -114,6 +117,7 @@ begin
finally
FInternalSetBounds := False;
end;
{$ENDIF}
end;
procedure TCustomLabel.SetAlignment(Value : TAlignment);

View File

@ -33,7 +33,7 @@
{off $DEFINE CHECK_POSITION}
{$IFDEF CHECK_POSITION}
const CheckPostionClassName = 'xxTPage';
const CheckPostionName = 'LazFindReplaceDialog';
const CheckPostionName = 'PropertyStoredIdentPostfixLabel';
const CheckPostionParentName = 'xxxEnvVarsPage';
function CheckPosition(AControl: TControl): boolean;
@ -2090,8 +2090,8 @@ begin
case CurControl.BorderSpacing.CellAlignHorizontal of
ccaFill: NewWidth:=CellBounds.Right-CellBounds.Left;
ccaLeftTop,ccaRightBottom:
if (CurControl.BorderSpacing.CellAlignHorizontal=ccaLeftTop)
<>(BidiMode=bdLeftToRight)
if (CurControl.BorderSpacing.CellAlignHorizontal=ccaRightBottom)
=(BidiMode=bdLeftToRight)
then
NewBounds.Left:=CellBounds.Right-NewWidth;
ccaCenter: NewBounds.Left:=NewBounds.Left
@ -2124,6 +2124,13 @@ begin
NewBounds.Right:=NewBounds.Left+NewWidth;
NewBounds.Bottom:=NewBounds.Top+NewHeight;
ControlBox.NewControlBounds:=NewBounds;
{$IFDEF CHECK_POSITION}
if CheckPosition(CurControl) then
DebugLn(['TAutoSizeBox.ComputeTableControlBounds ',DbgSName(CurControl),
' CellBounds=',dbgs(CellBounds),
' Preferred=',ControlBox.PreferredSize[asboHorizontal],'x',ControlBox.PreferredSize[asboVertical],
' NewBounds=',dbgs(NewBounds)]);
{$ENDIF}
end;
end;
end;
@ -7142,6 +7149,9 @@ begin
// realign childs
ReAlign;
{$ELSE}
if FControls<>nil then
for i:=0 to FControls.Count-1 do
TControl(FControls[i]).InvalidatePreferredSize;
// size this control
AdjustSize;
{$ENDIF}