How initialaize TPoint array: Poly: array [0..2] of TPoint = ( (1,1), (2,2), (3,3) ); //not compile

Posted on 2009-12-28
Last Modified: 2012-05-08
Hi Experts,

how to initialize a TPoint Array, like:
   Poly: array [0..2] of TPoint = ( (1,1), (2,2), (3,3) ); //this won't compile

Question by:odissey1
    LVL 22

    Accepted Solution

    Array of Tpoint is almost like Array of record, so you have to assign the values for members of record.

     Poly: array [0..2] of TPoint = ( (x:1;y:1), (x:2;y:2), (x:3;y:3) );
    LVL 7

    Expert Comment

      something like this will do the work (workaround).

    procedure TForm1.Button1Click(Sender: TObject);
     v: array [0..2, 0..1] of Integer = ((1, 2), (1, 1), (1, 1));
     p: array [0..2] of TPoint;
     i: Integer;
     for i := low(p) to high(p) do
      p[i] := Point(v[i][0], v[i][1]);

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
    Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now