[Lazarus] ComparePoints func

Sandro Cumerlato sandro.cumerlato at gmail.com
Wed Jul 26 17:12:54 CEST 2017


What do you think about:

function ComparePoints(P1, P2: TPoint): TPoint;
begin
  Result.X := (P1.X - P2.X);
  Result.Y := (P1.Y - P2.Y);
end;

Best regards.

Sandro Cumerlato


On Jul 26, 2017 3:56 PM, "Alexey via Lazarus" <lazarus at lists.lazarus-ide.org>
wrote:

I think LCL has many CompareNNNN funcs, but misses func for TPoint. Here
it's comparing x/y screen coordinates

function ComparePoints(P1, P2: TPoint): integer;
begin
  if (P1.X=P2.X) and (P1.Y=P2.Y) then exit(0);
  if (P1.Y>P2.Y) then exit(1);
  if (P1.Y<P2.Y) then exit(-1);
  if (P1.X>P2.X) then exit(1) else exit(-1);
end;


-- 
Regards,
Alexey

-- 
_______________________________________________
Lazarus mailing list
Lazarus at lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170726/2f15be52/attachment.html>


More information about the Lazarus mailing list