Fehlermeldung ist SIGSEGV. Vermutlich ein sehr grundlegender Denkfehler. Könnte es sein dass der Code nicht funktioniert weil T3Arr nur typ und keine Klasse ist ?
Code: Alles auswählen
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls;
type
T3DArr=Array of Array of Array of Double;
{ TCla1 }
TCla1 = class(TCustomControl)
private
FArr1:T3DArr;
function GetArr: T3DArr;
procedure SetArr(const AValue: T3DArr);
{ private declarations }
public
{ public declarations }
property Arr1:T3DArr read GetArr Write SetArr;
end;
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
FArr:T3DArr;
function GetArr: T3DArr;
procedure SetArr(const AValue: T3DArr);
{ private declarations }
public
{ public declarations }
property Arr:T3DArr read GetArr Write SetArr;
end;
var
Form1: TForm1;
C1:TCla1;
C2:TCla1;
implementation
{ TCla1 }
function TCla1.GetArr: T3DArr;
begin
result:=FArr1;
end;
procedure TCla1.SetArr(const AValue: T3DArr);
begin
FArr1:=AValue;
end;
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var i,j,k:integer;
begin
//Array wird gefüllt
SetLength(FArr, 2,2,2);
i:=0; j:=0; k:=0;
while (i<Length(Farr)) do begin
while (j<Length(Farr)) do begin
while (j<Length(Farr)) do begin
FArr[i,j,k]:=2*i+j-3*k;
inc(i); inc(j); inc(k);
end;
end;
end;
//Übergabeversuch
C1.Arr1:=self.Arr;
C2.Arr1:=C1.Arr1;
end;
function TForm1.GetArr: T3DArr;
begin
Result:=FArr;
end;
procedure TForm1.SetArr(const AValue: T3DArr);
begin
FArr:=AValue;
end;