lcl: cleanup and format the splitter code

git-svn-id: trunk@26435 -
This commit is contained in:
paul 2010-07-03 07:40:21 +00:00
parent 946f34ba8f
commit f4a3839b99
2 changed files with 187 additions and 195 deletions

View File

@ -471,10 +471,8 @@ type
FSplitterStartMouseXY: TPoint; // in screen coordinates FSplitterStartMouseXY: TPoint; // in screen coordinates
FSplitterStartLeftTop: TPoint; // in screen coordinates FSplitterStartLeftTop: TPoint; // in screen coordinates
function GetResizeControl: TControl; function GetResizeControl: TControl;
procedure SetAutoSnap(const AValue: boolean);
procedure SetBeveled(const AValue: boolean); procedure SetBeveled(const AValue: boolean);
procedure SetMinSize(const AValue: integer); procedure SetMinSize(const AValue: integer);
procedure SetResizeStyle(const AValue: TResizeStyle);
protected protected
class procedure WSRegisterClass; override; class procedure WSRegisterClass; override;
procedure CheckAlignment; procedure CheckAlignment;
@ -504,14 +502,14 @@ type
function GetSplitterPosition: integer; function GetSplitterPosition: integer;
public public
property Align default alLeft; property Align default alLeft;
property AutoSnap: boolean read FAutoSnap write SetAutoSnap default true; property AutoSnap: boolean read FAutoSnap write FAutoSnap default true;
property Beveled: boolean read FBeveled write SetBeveled default false; property Beveled: boolean read FBeveled write SetBeveled default false;
property Cursor default crHSplit; property Cursor default crHSplit;
property MinSize: integer read FMinSize write SetMinSize default 30; property MinSize: integer read FMinSize write SetMinSize default 30;
property OnCanResize: TCanResizeEvent read FOnCanResize write FOnCanResize; property OnCanResize: TCanResizeEvent read FOnCanResize write FOnCanResize;
property OnMoved: TNotifyEvent read FOnMoved write FOnMoved; property OnMoved: TNotifyEvent read FOnMoved write FOnMoved;
property ResizeAnchor: TAnchorKind read FResizeAnchor write SetResizeAnchor default akLeft; property ResizeAnchor: TAnchorKind read FResizeAnchor write SetResizeAnchor default akLeft;
property ResizeStyle: TResizeStyle read FResizeStyle write SetResizeStyle default rsUpdate; property ResizeStyle: TResizeStyle read FResizeStyle write FResizeStyle default rsUpdate;
end; end;

View File

@ -28,7 +28,8 @@ var
begin begin
Result := nil; Result := nil;
count := Control.Parent.ControlCount; count := Control.Parent.ControlCount;
if count > 0 then begin if count > 0 then
begin
fRect := Control.BoundsRect; fRect := Control.BoundsRect;
case Control.Align of case Control.Align of
alTop: begin alTop: begin
@ -55,13 +56,13 @@ begin
end; end;
end; // case end; // case
Dec(count); Dec(count);
for i := 0 to count do begin for i := 0 to count do
begin
CurControl := Control.Parent.Controls[i]; CurControl := Control.Parent.Controls[i];
if (CurControl <> Control) if (CurControl <> Control) and
and CurControl.Visible CurControl.Visible and
and (CurControl.Align in alignList) (CurControl.Align in alignList) and
and (PtInRect(CurControl.BoundsRect, fPoint)) (PtInRect(CurControl.BoundsRect, fPoint)) then Result := CurControl;
then Result := CurControl;
if Assigned(Result) then Break; if Assigned(Result) then Break;
end; // for i end; // for i
end; end;
@ -74,21 +75,17 @@ function FindVirtualOppositeControl(Control: TControl): TControl;
Result := False; Result := False;
case Control.Align of case Control.Align of
alTop: alTop:
if (CurControl.Align = Control.Align) if (CurControl.Align = Control.Align) and
and (CurControl.Top >= Control.BoundsRect.Bottom) (CurControl.Top >= Control.BoundsRect.Bottom) then Result := True;
then Result := True;
alBottom: alBottom:
if (CurControl.Align = Control.Align) if (CurControl.Align = Control.Align) and
and (CurControl.BoundsRect.Bottom <= Control.Top) (CurControl.BoundsRect.Bottom <= Control.Top) then Result := True;
then Result := True;
alLeft: alLeft:
if (CurControl.Align = Control.Align) if (CurControl.Align = Control.Align) and
and (CurControl.Left >= Control.BoundsRect.Right) (CurControl.Left >= Control.BoundsRect.Right) then Result := True;
then Result := True;
alRight: alRight:
if (CurControl.Align = Control.Align) if (CurControl.Align = Control.Align) and
and (CurControl.BoundsRect.Right <= Control.Left) (CurControl.BoundsRect.Right <= Control.Left) then Result := True;
then Result := True;
end; end;
end; end;
@ -109,14 +106,17 @@ var
begin begin
Result := nil; Result := nil;
count := Control.Parent.ControlCount; count := Control.Parent.ControlCount;
if count > 0 then begin if count > 0 then
begin
Dec(count); Dec(count);
for i := 0 to count do begin for i := 0 to count do
begin
CurControl := Control.Parent.Controls[i]; CurControl := Control.Parent.Controls[i];
if (CurControl <> Control) then begin if (CurControl <> Control) then
if ((Result = nil) and OppositeControl(CurControl, Control)) begin
or (Assigned(Result) and CompPos(CurControl, Result)) if ((Result = nil) and OppositeControl(CurControl, Control)) or
then Result := CurControl; (Assigned(Result) and CompPos(CurControl, Result)) then
Result := CurControl;
end; end;
end; // for i end; // for i
end; end;
@ -124,24 +124,12 @@ end;
{ TCustomSplitter } { TCustomSplitter }
procedure TCustomSplitter.SetResizeStyle(const AValue: TResizeStyle);
begin
if FResizeStyle=AValue then exit;
FResizeStyle:=AValue;
end;
class procedure TCustomSplitter.WSRegisterClass; class procedure TCustomSplitter.WSRegisterClass;
begin begin
inherited WSRegisterClass; inherited WSRegisterClass;
RegisterCustomSplitter; RegisterCustomSplitter;
end; end;
procedure TCustomSplitter.SetAutoSnap(const AValue: boolean);
begin
if FAutoSnap=AValue then exit;
FAutoSnap:=AValue;
end;
function TCustomSplitter.GetResizeControl: TControl; function TCustomSplitter.GetResizeControl: TControl;
begin begin
if Align in [alLeft,alRight,alTop,alBottom] then if Align in [alLeft,alRight,alTop,alBottom] then
@ -189,8 +177,8 @@ var
function GetControlSize(Control: TControl): Integer; function GetControlSize(Control: TControl): Integer;
begin begin
Result := 0; Result := 0;
if Assigned(Control) if Assigned(Control) then
then case ResizeAnchor of case ResizeAnchor of
akLeft, akRight: Result := Control.Width; akLeft, akRight: Result := Control.Width;
akTop, akBottom: Result := Control.Height; akTop, akBottom: Result := Control.Height;
end; end;
@ -246,8 +234,8 @@ var
if NewSize > EndSize then NewSize := EndSize; if NewSize > EndSize then NewSize := EndSize;
if NewSize < StartSize then NewSize := StartSize; if NewSize < StartSize then NewSize := StartSize;
if fAutoSnap and (NewSize < fMinSize) if AutoSnap and (NewSize < fMinSize) then
then NewSize := StartSize; NewSize := StartSize;
Result := NewSize; Result := NewSize;
end; end;
@ -267,12 +255,13 @@ var
count: Integer; count: Integer;
begin begin
Result := nil; Result := nil;
for count := Parent.ControlCount-1 downto 0 do begin for count := Parent.ControlCount - 1 downto 0 do
begin
CurControl := Parent.Controls[count]; CurControl := Parent.Controls[count];
if (CurControl <> Self) if (CurControl <> Self) and
and ((CurControl.Align = alClient) ((CurControl.Align = alClient) or ((Self.Align in [alTop,alBottom]) and
or ((Self.Align in [alTop,alBottom]) (CurControl.Align in [alLeft,alRight]))) then
and (CurControl.Align in [alLeft,alRight]))) then begin begin
Result := CurControl; Result := CurControl;
Break; Break;
end; end;
@ -284,7 +273,8 @@ var
CurControl: TControl; CurControl: TControl;
begin begin
CurControl := Control; CurControl := Control;
while Assigned(CurControl) do begin while Assigned(CurControl) do
begin
Control := CurControl; Control := CurControl;
CurControl := FindOppositeControl(Control); CurControl := FindOppositeControl(Control);
end; end;
@ -295,12 +285,14 @@ var
// returns the maximum size of the CurResizeControl due to parent's client // returns the maximum size of the CurResizeControl due to parent's client
// area // area
begin begin
if ResizeAnchor in [akLeft,akRight] then begin if ResizeAnchor in [akLeft, akRight] then
begin
if ResizeAnchor = akRight then if ResizeAnchor = akRight then
Result := CurResizeControl.Left + CurResizeControl.Width - Width Result := CurResizeControl.Left + CurResizeControl.Width - Width
else else
Result := Parent.ClientWidth - CurResizeControl.Left - Width; Result := Parent.ClientWidth - CurResizeControl.Left - Width;
end else begin end else
begin
if ResizeAnchor = akBottom then if ResizeAnchor = akBottom then
Result := CurResizeControl.Top + CurResizeControl.Height - Height Result := CurResizeControl.Top + CurResizeControl.Height - Height
else else
@ -329,7 +321,8 @@ begin
//DebugLn('TCustomSplitter.MoveSplitter ',DbgSName(Self),' Offset=',dbgs(Offset)); //DebugLn('TCustomSplitter.MoveSplitter ',DbgSName(Self),' Offset=',dbgs(Offset));
if Offset = 0 then Exit; if Offset = 0 then Exit;
if Align in [alLeft,alTop,alRight,alBottom] then begin if Align in [alLeft, alTop, alRight, alBottom] then
begin
// aligned Splitter // aligned Splitter
// -> consider aligned siblings for minimum and maximum movement // -> consider aligned siblings for minimum and maximum movement
@ -340,42 +333,40 @@ begin
// calculate minimum size // calculate minimum size
StartSize := 1; StartSize := 1;
if not fAutoSnap if not AutoSnap then
then Inc(StartSize, Inc(StartSize, Max(FMinSize, GetControlConstraintsMinSize(CurResizeControl)));
Max(fMinSize, GetControlConstraintsMinSize(CurResizeControl)));
if StartSize > 1 then Dec(StartSize); if StartSize > 1 then Dec(StartSize);
// calculate maximum size // calculate maximum size
if Assigned(CurOtherResizeControl) if Assigned(CurOtherResizeControl) then
then EndSize := GetControlSize(CurResizeControl) EndSize := GetControlSize(CurResizeControl) +
+ GetControlSize(CurOtherResizeControl) GetControlSize(CurOtherResizeControl) -
- Max(fMinSize, GetControlConstraintsMinSize(CurOtherResizeControl)) Max(fMinSize, GetControlConstraintsMinSize(CurOtherResizeControl))
else begin else
begin
VirtualOppositeControl := FindVirtualOppositeControl(Self); VirtualOppositeControl := FindVirtualOppositeControl(Self);
LastControl := FindLastControl(Self); LastControl := FindLastControl(Self);
case ResizeAnchor of case ResizeAnchor of
akLeft, akTop: begin akLeft, akTop:
if Assigned(VirtualOppositeControl) then
begin begin
EndSize := GetControlSize(CurResizeControl) if Assigned(VirtualOppositeControl) then
+ (GetControlMinPos(VirtualOppositeControl) EndSize := GetControlSize(CurResizeControl) +
- (GetControlMinPos(LastControl) (GetControlMinPos(VirtualOppositeControl) -
+ GetControlSize(LastControl))); (GetControlMinPos(LastControl) + GetControlSize(LastControl)))
end else
else EndSize := GetControlSize(CurResizeControl) EndSize := GetControlSize(CurResizeControl) +
+ (GetParentClientSize (GetParentClientSize -
- GetControlMinPos(LastControl) GetControlMinPos(LastControl) - GetControlSize(LastControl))
- GetControlSize(LastControl))
end; end;
akRight, akBottom: begin akRight, akBottom:
begin
if Assigned(VirtualOppositeControl) then if Assigned(VirtualOppositeControl) then
EndSize := GetControlSize(CurResizeControl) EndSize := GetControlSize(CurResizeControl) +
+ (GetControlMinPos(LastControl) (GetControlMinPos(LastControl) -
- (GetControlMinPos(VirtualOppositeControl) (GetControlMinPos(VirtualOppositeControl) + GetControlSize(VirtualOppositeControl)))
+ GetControlSize(VirtualOppositeControl))) else
else EndSize := GetControlSize(CurResizeControl) EndSize := GetControlSize(CurResizeControl) + GetControlMinPos(LastControl);
+ GetControlMinPos(LastControl);
end; end;
end; end;
end; end;
@ -384,37 +375,37 @@ begin
NewSize := CalcNewSize(StartSize, EndSize, Offset); NewSize := CalcNewSize(StartSize, EndSize, Offset);
// OnCanResize event // OnCanResize event
if CheckNewSize(NewSize) if CheckNewSize(NewSize) then
then SetAlignControlSize(NewSize); SetAlignControlSize(NewSize);
end else begin end else
begin
// anchored Splitter // anchored Splitter
// -> consider anchored siblings for minimum and maximum movement // -> consider anchored siblings for minimum and maximum movement
// OffsetMaxLower = maximum the Splitter can be moved top/left // OffsetMaxLower = maximum the Splitter can be moved top/left
OffsetMaxLower := Max(0,GetControlMinPos(Self)-fMinSize); OffsetMaxLower := Max(0, GetControlMinPos(Self) - FMinSize);
// OffsetMaxUpper = maximum the Splitter can be moved bottom/right // OffsetMaxUpper = maximum the Splitter can be moved bottom/right
OffsetMaxUpper := Max(0,GetParentsClientSize OffsetMaxUpper := Max(0, GetParentsClientSize -GetControlSize(Self) - GetControlMinPos(Self));
-GetControlSize(Self)-GetControlMinPos(Self));
//DebugLn(['TCustomSplitter.MoveSplitter OffsetMaxLower=',OffsetMaxLower,' OffsetMaxUpper=',OffsetMaxUpper]); //DebugLn(['TCustomSplitter.MoveSplitter OffsetMaxLower=',OffsetMaxLower,' OffsetMaxUpper=',OffsetMaxUpper]);
for i:=0 to AnchoredControlCount-1 do begin for i := 0 to AnchoredControlCount - 1 do
begin
CurResizeControl := AnchoredControls[i]; CurResizeControl := AnchoredControls[i];
//debugln('TCustomSplitter.MoveSplitter ',DbgSName(Self),' CurResizeControl=',DbgSName(CurResizeControl)); //debugln('TCustomSplitter.MoveSplitter ',DbgSName(Self),' CurResizeControl=',DbgSName(CurResizeControl));
if (CurResizeControl.AnchorSide[ResizeAnchor].Control=Self) if (CurResizeControl.AnchorSide[ResizeAnchor].Control = Self) or
or (CurResizeControl.AnchorSide[OppositeAnchor[ResizeAnchor]].Control=Self) (CurResizeControl.AnchorSide[OppositeAnchor[ResizeAnchor]].Control = Self) then
then begin begin
// this control uses this Splitter as anchor // this control uses this Splitter as anchor
// => moving the Splitter will resize CurResizeControl // => moving the Splitter will resize CurResizeControl
// => consider the constraints of CurResizeControl // => consider the constraints of CurResizeControl
// for minimum and maximum movement // for minimum and maximum movement
// calculate how much the CurResizeControl can be shrinked // calculate how much the CurResizeControl can be shrinked
CurMaxShrink:=Max(0,GetControlSize(CurResizeControl)- CurMaxShrink := Max(0, GetControlSize(CurResizeControl) - GetControlConstraintsMinSize(CurResizeControl));
GetControlConstraintsMinSize(CurResizeControl));
// calculate how much the CurResizeControl can be enlarged // calculate how much the CurResizeControl can be enlarged
CurMaxEnlarge:=Max(0,GetControlConstraintsMaxSize(CurResizeControl) CurMaxEnlarge := Max(0, GetControlConstraintsMaxSize(CurResizeControl) - GetControlSize(CurResizeControl));
-GetControlSize(CurResizeControl)); if CurMaxEnlarge=0 then
if CurMaxEnlarge=0 then begin begin
CurMaxEnlarge := GetParentsClientSize; CurMaxEnlarge := GetParentsClientSize;
if GetControlMinPos(CurResizeControl) < 0 then if GetControlMinPos(CurResizeControl) < 0 then
dec(CurMaxEnlarge, GetControlMinPos(CurResizeControl)); dec(CurMaxEnlarge, GetControlMinPos(CurResizeControl));
@ -422,13 +413,15 @@ begin
//debugln('TCustomSplitter.MoveSplitter ',DbgSName(Self),' CurResizeControl=',DbgSName(CurResizeControl),' CurMaxShrink=',dbgs(CurMaxShrink),' CurMaxEnlarge=',dbgs(CurMaxEnlarge),' ConstraintsMax=',dbgs(GetControlConstraintsMaxSize(CurResizeControl))); //debugln('TCustomSplitter.MoveSplitter ',DbgSName(Self),' CurResizeControl=',DbgSName(CurResizeControl),' CurMaxShrink=',dbgs(CurMaxShrink),' CurMaxEnlarge=',dbgs(CurMaxEnlarge),' ConstraintsMax=',dbgs(GetControlConstraintsMaxSize(CurResizeControl)));
// apply to the offset boundaries // apply to the offset boundaries
if (CurResizeControl.AnchorSide[akLeft].Control=Self) if (CurResizeControl.AnchorSide[akLeft].Control = Self) or
or (CurResizeControl.AnchorSide[akTop].Control=Self) then begin (CurResizeControl.AnchorSide[akTop].Control = Self) then
begin
if CurMaxShrink > 0 then if CurMaxShrink > 0 then
OffsetMaxLower := Min(OffsetMaxLower, CurMaxShrink); OffsetMaxLower := Min(OffsetMaxLower, CurMaxShrink);
if CurMaxEnlarge > 0 then if CurMaxEnlarge > 0 then
OffsetMaxUpper := Min(OffsetMaxUpper, CurMaxEnlarge); OffsetMaxUpper := Min(OffsetMaxUpper, CurMaxEnlarge);
end else begin end else
begin
if CurMaxEnlarge > 0 then if CurMaxEnlarge > 0 then
OffsetMaxLower := Min(OffsetMaxLower, CurMaxEnlarge); OffsetMaxLower := Min(OffsetMaxLower, CurMaxEnlarge);
if CurMaxShrink > 0 then if CurMaxShrink > 0 then
@ -465,20 +458,20 @@ end;
procedure TCustomSplitter.SetBeveled(const AValue: boolean); procedure TCustomSplitter.SetBeveled(const AValue: boolean);
begin begin
if FBeveled=AValue then exit; if FBeveled = AValue then Exit;
FBeveled := AValue; FBeveled := AValue;
Invalidate; Invalidate;
end; end;
procedure TCustomSplitter.SetMinSize(const AValue: integer); procedure TCustomSplitter.SetMinSize(const AValue: integer);
begin begin
if (FMinSize=AValue) or (AValue<1) then exit; if (FMinSize=AValue) or (AValue < 1) then Exit;
FMinSize := AValue; FMinSize := AValue;
end; end;
procedure TCustomSplitter.SetResizeAnchor(const AValue: TAnchorKind); procedure TCustomSplitter.SetResizeAnchor(const AValue: TAnchorKind);
begin begin
if FResizeAnchor=AValue then exit; if FResizeAnchor = AValue then Exit;
FResizeAnchor := AValue; FResizeAnchor := AValue;
if ResizeAnchor in [akLeft, akRight] then if ResizeAnchor in [akLeft, akRight] then
Cursor := crHSplit Cursor := crHSplit
@ -490,8 +483,10 @@ end;
procedure TCustomSplitter.SetResizeControl(const AValue: TControl); procedure TCustomSplitter.SetResizeControl(const AValue: TControl);
begin begin
if Align in [alLeft,alRight,alTop,alBottom] then begin if Align in [alLeft, alRight, alTop, alBottom] then
if AValue<>nil then begin begin
if AValue <> nil then
begin
case Align of case Align of
alLeft: Left := AValue.Left + 1; alLeft: Left := AValue.Left + 1;
alTop: Top := AValue.Top + 1; alTop: Top := AValue.Top + 1;
@ -499,14 +494,14 @@ begin
alBottom: Top := AValue.Top - 1; alBottom: Top := AValue.Top - 1;
end; end;
end; end;
end else begin end
else
AnchorSide[ResizeAnchor].Control := AValue; AnchorSide[ResizeAnchor].Control := AValue;
end; end;
end;
procedure TCustomSplitter.StartSplitterMove(const MouseXY: TPoint); procedure TCustomSplitter.StartSplitterMove(const MouseXY: TPoint);
begin begin
if FSplitDragging then exit; if FSplitDragging then Exit;
FSplitDragging := True; FSplitDragging := True;
FSplitterStartMouseXY := MouseXY; FSplitterStartMouseXY := MouseXY;
FSplitterStartLeftTop := Point(Left, Top); FSplitterStartLeftTop := Point(Left, Top);
@ -537,11 +532,9 @@ begin
GetCursorPos(MousePos); GetCursorPos(MousePos);
case ResizeAnchor of case ResizeAnchor of
akLeft, akRight: akLeft, akRight:
Offset := (MousePos.X - FSplitterStartMouseXY.X) Offset := (MousePos.X - FSplitterStartMouseXY.X) - (Self.Left - FSplitterStartLeftTop.X);
- (Self.Left - FSplitterStartLeftTop.X);
akTop, akBottom: akTop, akBottom:
Offset := (MousePos.Y - FSplitterStartMouseXY.Y) Offset := (MousePos.Y - FSplitterStartMouseXY.Y) - (Self.Top - FSplitterStartLeftTop.Y);
- (Self.Top - FSplitterStartLeftTop.Y);
end; end;
if Offset = 0 then Exit; if Offset = 0 then Exit;
@ -571,8 +564,8 @@ var
procedure FindNearerControl(CurValue, Limit: integer); procedure FindNearerControl(CurValue, Limit: integer);
begin begin
if (CurValue<=Limit) if (CurValue <= Limit) and ((Result = nil) or (BestValue < CurValue)) then
and ((Result=nil) or (BestValue<CurValue)) then begin begin
BestValue := CurValue; BestValue := CurValue;
Result := CurControl; Result := CurControl;
end; end;
@ -583,12 +576,12 @@ begin
BestValue:=0; BestValue:=0;
if (Parent = nil) then Exit; if (Parent = nil) then Exit;
if not (Align in [alLeft,alTop,alRight,alBottom]) then exit; if not (Align in [alLeft,alTop,alRight,alBottom]) then exit;
for i := Parent.ControlCount-1 downto 0 do begin for i := Parent.ControlCount - 1 downto 0 do
begin
CurControl := Parent.Controls[i]; CurControl := Parent.Controls[i];
if (CurControl <> Self) if (CurControl <> Self) and (CurControl.Visible) and
and (CurControl.Visible) ((CurControl.Align = Self.Align) or (CurControl.Align=alClient)) then
and ((CurControl.Align = Self.Align) or (CurControl.Align=alClient)) begin
then begin
case Self.Align of case Self.Align of
alLeft: FindNearerControl(CurControl.Left+CurControl.Width,Left); alLeft: FindNearerControl(CurControl.Left+CurControl.Width,Left);
alTop: FindNearerControl(CurControl.Top+CurControl.Height,Top); alTop: FindNearerControl(CurControl.Top+CurControl.Height,Top);
@ -683,8 +676,7 @@ begin
alRight: FResizeAnchor:=akRight; alRight: FResizeAnchor:=akRight;
alBottom: FResizeAnchor:=akBottom; alBottom: FResizeAnchor:=akBottom;
end; end;
if ((Align = Value) and (OldResizeAnchor=FResizeAnchor)) if ((Align = Value) and (OldResizeAnchor = FResizeAnchor)) or (Value = alClient) then
or (Value=alClient) then
Exit; Exit;
OldWidth := Width; OldWidth := Width;
OldHeight := Height; OldHeight := Height;
@ -701,12 +693,15 @@ begin
CheckAlignment; CheckAlignment;
// lfm contains correct size already // lfm contains correct size already
if not (csLoading in ComponentState) then begin if not (csLoading in ComponentState) then
if (OldResizeAnchor in [akLeft,akRight])=(ResizeAnchor in [akLeft,akRight]) begin
then begin if (OldResizeAnchor in [akLeft,akRight])=(ResizeAnchor in [akLeft,akRight]) then
begin
// keep width and height // keep width and height
SetBounds(Left,Top,OldWidth,OldHeight); SetBounds(Left,Top,OldWidth,OldHeight);
end else begin end
else
begin
// resize // resize
if Align in [alLeft,alRight] then if Align in [alLeft,alRight] then
Width:=OldHeight Width:=OldHeight
@ -854,8 +849,7 @@ begin
Width := 5; Width := 5;
end; end;
procedure TCustomSplitter.AnchorSplitter(Kind: TAnchorKind; AControl: TControl procedure TCustomSplitter.AnchorSplitter(Kind: TAnchorKind; AControl: TControl);
);
procedure AnchorSplitterSides( procedure AnchorSplitterSides(
ResizeSide,// the side of the Splitter, where AControl is touched and moved ResizeSide,// the side of the Splitter, where AControl is touched and moved
@ -894,8 +888,8 @@ begin
akBottom: AnchorSplitterSides(akBottom, akTop, akLeft, akRight); akBottom: AnchorSplitterSides(akBottom, akTop, akLeft, akRight);
end; end;
if (OldResizeAnchor in [akLeft,akRight])=(ResizeAnchor in [akLeft,akRight]) if (OldResizeAnchor in [akLeft, akRight]) = (ResizeAnchor in [akLeft, akRight]) then
then begin begin
// keep width and height // keep width and height
SetBounds(Left, Top, OldWidth, OldHeight); SetBounds(Left, Top, OldWidth, OldHeight);
end else begin end else begin