?
Solved

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

Posted on 2009-12-28
2
Medium Priority
?
886 Views
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

Sincerely,
odissey1
0
Comment
Question by:odissey1
2 Comments
 
LVL 23

Accepted Solution

by:
Ferruccio Accalai earned 100 total points
ID: 26133694
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) );
0
 
LVL 7

Expert Comment

by:twinsoft
ID: 26133741
Hi,
  something like this will do the work (workaround).

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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month13 days, 19 hours left to enroll

809 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