Autor Beitrag
G-McKree
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 22.06.03 09:18 
Ich schreib gerade an einem kleinen program, einem editor mit dem ich spielfelder erstellen kann. das program, das mit den spielfeldern was anfangen kann kommt später :D .

also zum problem: die einzelnen spielfelder sind nich immer nur mit denen verbunden, die neben ihnen sind, und deshalb muss ich irgentwo speichern wohin man wan gehen darf. ein dynArray chien mir da perfekt zu sein, aber delphi hat kein verständniss dafür und will mir nich erlauben eine dynArray-property bei meiner komponente zu setzen.


Zuletzt bearbeitet von G-McKree am So 22.06.03 10:45, insgesamt 2-mal bearbeitet
Tweafis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 647

WinXP + fbsd
Delphi 5 Prof
BeitragVerfasst: So 22.06.03 09:29 
hmm ich denke mal du mahcst das so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
private
  fconnections: array of Integer;
published
  property connections: array of Integer write bla read bla


Probier mal nen eigenen Typ zu erstellen
z.B.
ausblenden Delphi-Quelltext
1:
TDynConnect = array of Integer;					


ausblenden Delphi-Quelltext
1:
fconnections: TDynConnect					

ausblenden Delphi-Quelltext
1:
property connections: TDynConnect					


oder sowas in der art

_________________
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 22.06.03 10:40 
thx

hmm, nächstes problem:

der dynArray des objects auf das ich klicke soll um 1 größer sein

ausblenden Quelltext
1:
setlength(Tquad(sender).Con , length(Tquad(sender).Con) + 1)					

funzt aber net
con is die dynArray property
und delphi meint:
[Error] Unit1.pas(109): Constant object cannot be passed as var parameter
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: So 22.06.03 11:20 
Du kannst keine Eigenschaften an Funktionen übergeben, die an der Stellen einen var oder out Parameter verlagen.

_________________
Ist Zeit wirklich Geld?
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 22.06.03 13:17 
und das bedeutet?
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: So 22.06.03 14:10 
Das setlength(Tquad(sender).Con, ...) nicht funktioniert, weil SetLength so deklariert ist (Compiler Magic muss beachtet werden):
procedure SetLength(var DynArray of DynamicArray type; Count [, ...]);

Du musst dir also eine Methode schreiben, die SetLength() mit dem Feld anstatt der Eigenschaft aufruft.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
private
  FDynArray: TMyDynArray; // ==> Feld
public
  property DynArray: TMyDynArray read FDynArray; // ==> Eigenschaft
end;

_________________
Ist Zeit wirklich Geld?
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 22.06.03 15:35 
ich glaub jez hab ichs
Tweafis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 647

WinXP + fbsd
Delphi 5 Prof
BeitragVerfasst: So 22.06.03 15:38 
Du kannst nicht zu einem dynamischen Array 1 dazuaddieren.

_________________
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 22.06.03 15:42 
Tweafis hat folgendes geschrieben:
Du kannst nicht zu einem dynamischen Array 1 dazuaddieren.

ich weiss ich hab das 'length()' vergessen