ich kämpfe gerade mit der Übergabe von Daten eines Arrays:
Code: Alles auswählen
procedure PaintCross(Canvas: TfpgCanvas; XLeft, YUp, XRight, YLow, CrossX1, CrossX2, CrossY1, CrossY2: integer);
var
P: array[0..12] of TPoint;
begin
SetLength(P, 13); //Diese Zeile habe ich ergänzt, nachdem ich das Array P in ein dynamisches Array array of TPoint geändert habe!
P[0].x := XLeft; P[0].y := CrossY1;
P[1].x := CrossX1; P[1].y := P[0].y;
P[2].x := P[1].x; P[2].y := YUp;
P[3].x := CrossX2; P[3].y := P[2].y;
P[4].x := P[3].x; P[4].y := CrossY1;
P[5].x := XRight; P[5].y := P[4].y;
P[6].x := P[5].x; P[6].y := CrossY2;
P[7].x := CrossX2; P[7].y := P[6].y;
P[8].x := P[7].x; P[8].y := YLow;
P[9].x := CrossX1; P[9].y := P[8].y;
P[10].x := P[9].x; P[10].y := CrossY2;
P[11].x := XLeft; P[11].y := P[10].y;
P[12].x := P[11].x; P[12].y := CrossY1;
Canvas.DrawPolygon(P);
end;
Canvas.DrawPolygon hatte diese Deklaration:
Code: Alles auswählen
procedure DoDrawPolygon(Points: PPoint; NumPts: Integer; Winding: boolean = False); override;
Dabei erhalte ich einn Compilerfehler Inkompatible Typen GOT array of TPoint expected Open Array of TPoint
Nun habe ich die Deklaration geändert in:
Code: Alles auswählen
procedure DoDrawPolygon(Points: array of TPoint; NumPts: Integer; Winding: boolean = False); override;
und das Array in der PaintCross Prozedur von
Code: Alles auswählen
var P: array[0..12] of TPoint;
Code: Alles auswählen
var P: array of TPoint;
und im Code der Prozedur PaintCross SetLength(P, 13) als erste Zeile hinzugefügt.
Dennoch erhalte ich den Compilerfehler im Strangtitel.
Was kann ich hier machen, damit ich den Code übersetzen kann?
Die Compilerdirektive {$mode objfpc} ist gesetzt.