Also ich habe ein object nennen wir es TBlabla welches ein von mir erstellestes object ist das als property Test hat.
so diese Property test soll nun aus 3 dynamischen arrays bestehen also ein neues Object TTest mit 3 eigenschaften die jeweils ein Dynamisches array sind gut soweit alles in ordnung
jetzt versuche ich das ganze aber umzusetzen dabei kam folgendes raus:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32:
| type TIntArray = Array of integer; Ttest = class(TObject) private Ftest1 : TIntArray; Ftest2 : TIntArray; Ftest3 : TIntArray; procedure Settest1(const Value: TIntArray); procedure Settest2(const Value: TIntArray); procedure Settest3(const Value: TIntArray); published Property test1 : TIntArray read Ftest1 write Settest1; Property test2 : TIntArray read Ftest2 write Settest2; Property test3 : TIntArray read FTest3 write Settest3; end;
implementation
procedure Ttest.Settest1(const Value: TIntArray); begin Ftest1 := Value; end;
procedure Ttest.Settest2(const Value: TIntArray); begin Ftest2 := Value; end;
procedure Ttest.Settest3(const Value: TIntArray); begin Ftest3 := Value; end; |
so nun ist das aber total umständlich wenn ich das benutzen will -.-
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21:
| procedure TForm1.Button2Click(Sender: TObject); var Test : array[0..13] of Ttest ; Intarray : Array[0..2] of TIntArray ; i : integer; blabla : Tblabla; begin Setlength(IntArray[0],14); Setlength(IntArray[1],14); Setlength(IntArray[2],14); for i := 0 to 13 do begin IntArray[0][i] := 0 ; IntArray[1][i] := 3 ; IntArray[2][i] := 80 ; end; test[0] := Ttest.Create ; test[0].test1 := intArray[0] ; test[0].test2 := intArray[1] ; test[0].test3 := intArray[2] ; Blabla.Test := Test[0]; end; |
nun wollte ich einfach fragen ob das nicht doch irgendwie einfacher geht oder ob man das wirklich so kompliziert machen muss >_<
thx schonmal im voraus für eure hilfe/antworten