LCL: TCustomSplitter.SetAnchors: adapt anchors before applying

git-svn-id: trunk@36861 -
This commit is contained in:
mattias 2012-04-17 07:55:13 +00:00
parent b20150d99c
commit d57368b809
2 changed files with 13 additions and 10 deletions

View File

@ -339,7 +339,7 @@ type
procedure SetMinSize(const AValue: integer);
protected
class procedure WSRegisterClass; override;
procedure CheckAlignment;
function AdaptAnchors(const a: TAnchors): TAnchors;
function CheckNewSize(var NewSize: Integer): Boolean; virtual;
function CheckOffset(var NewOffset: Integer): Boolean; virtual;

View File

@ -777,7 +777,7 @@ begin
else
Cursor := crVSplit;
CheckAlignment;
Anchors:=AdaptAnchors(Anchors);
// lfm contains correct size already
if not (csLoading in ComponentState) then
@ -802,19 +802,22 @@ begin
end;
procedure TCustomSplitter.SetAnchors(const AValue: TAnchors);
var
NewValue: TAnchors;
begin
if AValue = Anchors then exit;
inherited SetAnchors(AValue);
CheckAlignment;
NewValue:=AdaptAnchors(AValue);
if NewValue = Anchors then exit;
inherited SetAnchors(NewValue);
end;
procedure TCustomSplitter.CheckAlignment;
function TCustomSplitter.AdaptAnchors(const a: TAnchors): TAnchors;
begin
Result:=a;
case Align of
alLeft: Anchors := Anchors - [akRight] + [akLeft];
alTop: Anchors := Anchors - [akBottom] + [akTop];
alRight: Anchors := Anchors + [akRight] - [akLeft];
alBottom: Anchors := Anchors + [akBottom] - [akTop];
alLeft: Result := Result - [akRight] + [akLeft];
alTop: Result := Result - [akBottom] + [akTop];
alRight: Result := Result + [akRight] - [akLeft];
alBottom: Result := Result + [akBottom] - [akTop];
end;
end;