unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TMyVarArray =
Array of Variant;
type
TForm1 =
class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function LocalNewArray(): TMyVarArray;
begin
//Result := VarArrayCreate([-3,-2],varVariant);
//Result := VarArrayCreate([0,5],varVariant);
SetLength(Result,0);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
lArray1:
Array of Variant;
lArray2:
Array of Variant;
begin
lArray1 := VarArrayCreate([0,5],varVariant);
//SetLength(lArray1[0],0);
lArray1[0] := VarArrayCreate([-3,-2],varVariant);
lArray1[0][-2] := '
Test';
lArray2 := VarArrayCreate([0,10],varVariant);
lArray2[0] := VarArrayCreate([0,10],varVariant);
//lArray2[0] := LocalNewArray();
//SetLength(lArray2[0],0);
try
Label1.Caption := lArray1[0][-2];
//Label1.Caption := IntToStr(Length(lArray1));
except
Label1.Caption := '
Fehler';
end;
try
Label2.Caption := IntToStr(Length(lArray2));
except
Label2.Caption := '
Fehler';
end;
try
//Label3.Caption := IntToStr(VarArrayHighBound(lArray1[0],1));
Label3.Caption := IntToStr(VarArrayDimCount(lArray1[0]));
//Label3.Caption := IntToStr(Length(lArray1[0]));
//Label3.Caption := IntToStr(High(lArray1[0]));
except
Label3.Caption := '
Fehler';
end;
try
//Label4.Caption := IntToStr(VarArrayLowBound(lArray2,2));
//Label4.Caption := IntToStr(VarArrayHighBound(lArray2,2));
//Label4.Caption := IntToStr(VarArrayLowBound(lArray2[0],1));
//Label4.Caption := IntToStr(VarArrayHighBound(lArray2[0],1));
//Label4.Caption := IntToStr(VarArrayDimCount(lArray2[0]));
Label4.Caption := IntToStr(Length(lArray2[0]));
//Label4.Caption := IntToStr(High(lArray2[0]));
except
Label4.Caption := '
Fehler';
end;
end;
end.