Autor Beitrag
nepleurepas
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164

Win XP

BeitragVerfasst: Mo 18.06.07 16:03 
Hallo,
wollte eine procedure machen, die ein stringrid inhalt in ein zweidimensionales array packt.
hier mien versuch:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure sgtoarray (sg: Tstringgrid; feld: array of array of integer; length: integer);
var z, s: integer;
begin
setlength(feld, length, length);
For z:= 1 to 9 do
 begin
 For s:= 1 to 9 do
  begin
  feld[z,s]:= strtoint(form1.sg1.cells[s,z]);
  end;
 end;
end;


leider kommt gleich im kopf die fehlermeldung "identifier expected, but array found" .
mit eindimensionale array funktionierts? Geht es zweidimensional nicht?
Habs auch schon mit Statischen versucht.
Bitte helft mir.

Stefan
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Mo 18.06.07 16:08 
Probiers mal so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
type
 TFeld = array of array of integer;


procedure sgtoarray (sg: Tstringgrid; feld:TFeld; length: integer);
....
nepleurepas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164

Win XP

BeitragVerfasst: Mo 18.06.07 16:12 
user profile iconMarc. hat folgendes geschrieben:
Probiers mal so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
type
 TFeld = array of array of integer;


procedure sgtoarray (sg: Tstringgrid; feld:TFeld; length: integer);
....


ok, danke, es geht.
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Mo 18.06.07 16:14 
Genau so gehst du auch vor, wenn du der Rückgabetyp einer Funktion f ein Array sein soll. ;)