Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: porting function to delphi seattle



Permlink Replies: 1 - Last Post: Sep 15, 2017 3:46 AM Last Post By: loki loki
drama mix

Posts: 37
Registered: 6/27/12
porting function to delphi seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 15, 2017 3:04 AM
i am stuck with this function its working on delphi berlin but i need to get it work in delphi seattle

delphi seattle does not have declaration to THorzRectAlign & TVertRectAlign what could be the equivalent for it in seattle ?

function TALRectD.PlaceInto(const ADesignatedArea: TALRectD; const AHorzAlign: THorzRectAlign;
  const AVertAlign: TVertRectAlign): TALRectD;
var
  LLocation: TALPointD;
begin
  Result := Self;
  if (Self.Width > ADesignatedArea.Width) or (Self.Height > ADesignatedArea.Height) then
    Result := Result.FitInto(ADesignatedArea);
 case AHorzAlign of
   THorzRectAlign.Center: LLocation.X := (ADesignatedArea.Left + ADesignatedArea.Right - Result.Width) / 2;
   THorzRectAlign.Left: LLocation.X := ADesignatedArea.Left;
   THorzRectAlign.Right: LLocation.X := ADesignatedArea.Right - Result.Width;
 end;
 case AVertAlign of
   TVertRectAlign.Center: LLocation.Y := (ADesignatedArea.Top + ADesignatedArea.Bottom - Result.Height) / 2;
   TVertRectAlign.Top: LLocation.Y := ADesignatedArea.Top;
   TVertRectAlign.Bottom: LLocation.Y := ADesignatedArea.Bottom - Result.Height;
 end;
 Result.SetLocation(LLocation);
end;
loki loki

Posts: 787
Registered: 7/1/02
Re: porting function to delphi seattle
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 15, 2017 3:46 AM   in response to: drama mix in response to: drama mix
On 9/15/2017 1:04 PM, drama mix wrote:
i am stuck with this function its working on delphi berlin but i need to get it work in delphi seattle

delphi seattle does not have declaration to THorzRectAlign & TVertRectAlign what could be the equivalent for it in seattle ?

function TALRectD.PlaceInto(const ADesignatedArea: TALRectD; const AHorzAlign: THorzRectAlign;
   const AVertAlign: TVertRectAlign): TALRectD;
var
   LLocation: TALPointD;
begin
   Result := Self;
   if (Self.Width > ADesignatedArea.Width) or (Self.Height > ADesignatedArea.Height) then
     Result := Result.FitInto(ADesignatedArea);
  case AHorzAlign of
    THorzRectAlign.Center: LLocation.X := (ADesignatedArea.Left + ADesignatedArea.Right - Result.Width) / 2;
    THorzRectAlign.Left: LLocation.X := ADesignatedArea.Left;
    THorzRectAlign.Right: LLocation.X := ADesignatedArea.Right - Result.Width;
  end;
  case AVertAlign of
    TVertRectAlign.Center: LLocation.Y := (ADesignatedArea.Top + ADesignatedArea.Bottom - Result.Height) / 2;
    TVertRectAlign.Top: LLocation.Y := ADesignatedArea.Top;
    TVertRectAlign.Bottom: LLocation.Y := ADesignatedArea.Bottom - Result.Height;
  end;
  Result.SetLocation(LLocation);
end;


skip it under seattle, you don't need it i think

{$IF CompilerVersion >= 31} // berlin

function TALRectD.PlaceInto(const ADesignatedArea: TALRectD; const
AHorzAlign: THorzRectAlign;
const AVertAlign: TVertRectAlign): TALRectD;
var
LLocation: TALPointD;
begin
Result := Self;
if (Self.Width > ADesignatedArea.Width) or (Self.Height >
ADesignatedArea.Height) then
Result := Result.FitInto(ADesignatedArea);
case AHorzAlign of
THorzRectAlign.Center: LLocation.X := (ADesignatedArea.Left +
ADesignatedArea.Right - Result.Width) / 2;
THorzRectAlign.Left: LLocation.X := ADesignatedArea.Left;
THorzRectAlign.Right: LLocation.X := ADesignatedArea.Right -
Result.Width;
end;
case AVertAlign of
TVertRectAlign.Center: LLocation.Y := (ADesignatedArea.Top +
ADesignatedArea.Bottom - Result.Height) / 2;
TVertRectAlign.Top: LLocation.Y := ADesignatedArea.Top;
TVertRectAlign.Bottom: LLocation.Y := ADesignatedArea.Bottom -
Result.Height;
end;
Result.SetLocation(LLocation);

end;
{$ENDIF}
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02