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); procedure SetMinSize(const AValue: integer);
protected protected
class procedure WSRegisterClass; override; class procedure WSRegisterClass; override;
procedure CheckAlignment; function AdaptAnchors(const a: TAnchors): TAnchors;
function CheckNewSize(var NewSize: Integer): Boolean; virtual; function CheckNewSize(var NewSize: Integer): Boolean; virtual;
function CheckOffset(var NewOffset: Integer): Boolean; virtual; function CheckOffset(var NewOffset: Integer): Boolean; virtual;

View File

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