Einzelnen Beitrag anzeigen

darthdungeon

Registriert seit: 24. Mär 2007
5 Beiträge
 
Delphi 7 Enterprise
 
#4

Re: Porblem mit Arrays, die Pointer auf Record sind

  Alt 29. Mär 2007, 19:22
okay, danke funktioniert wirklich.^^
nur wenn ich das prog schließe, kriege ich EAccessViolation-Errors, ne unschöne sache. wieso und wie bekomme ich die weg?
mein bisheriger programmcode:

Delphi-Quellcode:
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls;
type
  PPoints = ^TPoints;

  TPoints = record
   x, y : Integer;
   end;

  PEdge = ^TEdge;

  TEdge = record
  point1, point2: PPoints;
  next_edge: PEdge;
  end;

  TArea = record
  edge: TEdge;

end;

type
  TForm1 = class(TForm)
    Image1: TImage;
    procedure FormCreate(Sender: TObject);

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
    area_list: array of TArea;
    edge_list: array of TEdge;
    point_list: array of TPoints;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);

procedure init_faltpolygon;

begin

setlength(area_list, 1);
setlength(edge_list, 4);
setlength(point_list, 4);


point_list[0].x:=100;
point_list[0].y:=100;

point_list[1].x:=500;
point_list[1].y:=100;

point_list[2].x:=500;
point_list[2].y:=500;

point_list[3].x:=100;
point_list[3].y:=500;

edge_list[0].point1:=@point_list[0];
edge_list[0].point2:=@point_list[1];
edge_list[0].next_edge:=@edge_list[1];
edge_list[1].point1:=@point_list[1];
edge_list[1].point2:=@point_list[2];
edge_list[1].next_edge:=@edge_list[2];
edge_list[2].point1:=@point_list[2];
edge_list[2].point2:=@point_list[3];
edge_list[2].next_edge:=@edge_list[3];
edge_list[3].point1:=@point_list[3];
edge_list[3].point2:=@point_list[0];
edge_list[3].next_edge:=@edge_list[0];

area_list[1].edge:=edge_list[1];

end;


begin

init_faltpolygon;

end;

end.
Nichts ist unmöglich, das Unmögliche dauert nur etwas länger!
  Mit Zitat antworten Zitat