delphiconstantspoint

How to declare a constant TPoint?


Good morning, I am trying to declare constant TPoint in Delphi, how do you do that ?

None of the following works

// ...
const POS_A : Tpoint = (3,3);  
const POS_B : Tpoint = Point(3,10);
const POS_C : Tpoint = Tpoint(3,20);
const POS_D : Tpoint = TPoint.create(3,30);
// ...

Any clue ?


Solution

  • According to the documentation on constants, specifically the part about records, you write

    const
      MyPoint: TPoint = (X: 3; Y: 7);