LCL: SetAlign: restore the basebounds set before changes

git-svn-id: trunk@36870 -
This commit is contained in:
mattias 2012-04-17 08:15:46 +00:00
parent 73fef58a27
commit eb05b8141f
2 changed files with 4 additions and 3 deletions

View File

@ -3976,9 +3976,8 @@ begin
begin
// in case asrCenter, both sides are controlled by one anchor
// -> disable opposite anchor and aligning
if FOwner.Align in [alLeft,alTop,alRight,alBottom,alClient] then begin
if not (FOwner.Align in [alNone,alCustom]) then
FOwner.Align:=alNone;
end;
FOwner.Anchors:=FOwner.Anchors-[OppositeAnchor[Kind]];
end;
end;

View File

@ -3707,10 +3707,12 @@ procedure TControl.SetAlign(Value: TAlign);
var
OldAlign: TAlign;
a: TAnchorKind;
OldBaseBounds: TRect;
begin
if FAlign = Value then exit;
//DebugLn(['TControl.SetAlign ',DbgSName(Self),' Old=',DbgS(FAlign),' New=',DbgS(Value),' ',Anchors<>AnchorAlign[FAlign]]);
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.setalign'){$ENDIF};
OldBaseBounds:=BaseBounds;
OldAlign := FAlign;
FAlign := Value;
if (not (csLoading in ComponentState))
@ -3731,7 +3733,7 @@ begin
if (Anchors = AnchorAlign[OldAlign]) and (Anchors <> AnchorAlign[FAlign]) then
Anchors := AnchorAlign[FAlign];
if not (csLoading in ComponentState) then
BoundsRect:=BaseBounds;
BoundsRect:=OldBaseBounds;
//DebugLn(['TControl.SetAlign ',DbgSName(Self),' Cur=',DbgS(FAlign),' New=',DbgS(Value),' ',Anchors<>AnchorAlign[FAlign],' Anchors=',dbgs(Anchors)]);
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.setalign'){$ENDIF};
end;