[Lazarus] ComparePoints func

Michael Van Canneyt michael at freepascal.org
Wed Jul 26 17:22:02 CEST 2017



On Wed, 26 Jul 2017, Graeme Geldenhuys via Lazarus wrote:

> On 2017-07-26 14:54, Alexey via Lazarus wrote:
>> I think LCL has many CompareNNNN funcs, but misses func for TPoint. Here
>> it's comparing x/y screen coordinates
>
> Why not extend TPoint with an IsEquals() method, so you can do something 
> like
>
>
> var
>   p1: TPoint;
>   p2: TPoint;
> begin
>   // ... populate p1 & p2
>   if p1.IsEquals(p2) then
>     // do something.
>
>
> ComparePoints() returning a Integer is not a very friendly return type 
> either, whereas Boolean makes more sense.

First start by defining what ComparePoints is supposed to measure or compare.

If "equals" is needed, why not simply use p1=p2 ?

Michael.


More information about the Lazarus mailing list