Aloahe Posted September 26, 2011 Share Posted September 26, 2011 Hi there.. here the problem type testtype = record Pic,Tol:integer; Name:string; end; var typearr: Array of testtype; at now I only can write fill my types with: typearr[0].Pic:=bmp; typearr[0].Tol:=30; typearr[0].name:='testpic'; typearr[1].Pic:=bmp1; typearr[1].Tol:=301; typearr[1].name:='testpic1'; the array shows me [(bmp,30,'testpic),(bmp1,301,'testpic1'); if I write an Array of Integers I can do it with Integerarray:=[1,2,3,4,5,-...] but it wont work wih array of others (my own types) any Ideas how I can fill the arrays of my types in the easiert way? greetings Quote Link to comment Share on other sites More sharing options...
mormonman Posted September 26, 2011 Share Posted September 26, 2011 Make a function that creates that type: function NewType(AVar: Integer; ABool: Boolean): TMyType; begin Result.Int := AVar; Result.Bool := ABool; end; Then use that function to create the array. MyTypeArr := [NewType(1, false), NewType(2, true)]; Quote Link to comment Share on other sites More sharing options...
Aloahe Posted September 27, 2011 Author Share Posted September 27, 2011 program New; type TMyType = record AVar: Integer; ABool: Boolean; end; var mytypearr: array of Tmytype; function NewType(AVar: Integer; ABool: Boolean): TMyType; begin result.AVar := Avar; result.ABool := ABool; //Result.Int := AVar; //Result.Bool := ABool; end; begin MyTypeArr := [NewType(1, false), NewType(2, true)]; writeln('wait'); end. thats the right ... but thx for helping Quote Link to comment Share on other sites More sharing options...
mormonman Posted September 27, 2011 Share Posted September 27, 2011 program New; type TMyType = record AVar: Integer; ABool: Boolean; end; var mytypearr: array of Tmytype; function NewType(AVar: Integer; ABool: Boolean): TMyType; begin result.AVar := Avar; result.ABool := ABool; //Result.Int := AVar; //Result.Bool := ABool; end; begin MyTypeArr := [NewType(1, false), NewType(2, true)]; writeln('wait'); end. thats the right ... but thx for helping I was assuming you already knew how to create the type and then add your own variables to my "shell". Quote Link to comment Share on other sites More sharing options...