Autor Beitrag
Die Brotmafia
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110

Win XP Suse Linux 9.3
Delphi 7 Enterprise, Delphi 2005
BeitragVerfasst: So 01.01.06 16:27 
Also, ich brauch eine kleine Hilfe in Sachen Arrays:

Hab mir jetzt schon 3 mal das Tutorial dazu durchgelesen (www.dsdt.info/tutorials/crashkurs/?page=6)

aber ich blick einfach nicht wozu man die Teile braucht...


Wie kann man so ein Array anwenden, z.B. in nem StringGrid könnte man das doch brauchen, was kann man dann damit anfangen?

Am besten mit Beispiel!

danke!
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: So 01.01.06 16:34 
Ein einfaches Beispiel aus der Praxis:
Ich schreib grad an nem Netzwerkchat rum. Um sich die Benutzer und deren Informationen zu merken haben wir folgendes Deklariert:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
type

TUser = record
  Name: string;
  IP: string;
  ProtocolVersion: TProtocolVersion //(TProtokollVersion = (....) )
  {weitere Infos, teilweise halt keine Strings}
end;

implemetation

var
Users : array of TUser;

{...}


Somit kann man eine Vielzahl von Informationen praktisch in einer Variable sammeln.

Gruß alias5000

_________________
Programmers never die, they just GOSUB without RETURN
Die Brotmafia Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110

Win XP Suse Linux 9.3
Delphi 7 Enterprise, Delphi 2005
BeitragVerfasst: So 01.01.06 16:36 
Wie liest man das Array dann wieder aus?
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: So 01.01.06 16:47 
ausblenden Delphi-Quelltext
1:
Users[xy]					

Damit erhälst du Zugriff auf den xy-sten Record.

_________________
Programmers never die, they just GOSUB without RETURN
Die Brotmafia Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110

Win XP Suse Linux 9.3
Delphi 7 Enterprise, Delphi 2005
BeitragVerfasst: So 01.01.06 17:29 
Ich blicks mal wieder 0!!

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
type

TUser = record
  Name: string;
  IP: string;
  ProtocolVersion: TProtocolVersion //(TProtokollVersion = (....) )
  {weitere Infos, teilweise halt keine Strings}
end;


So, ich geb das ein unter Type, dann kommt ": Expected but = found"

super!

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: So 01.01.06 18:04 
Das iss vllcht noch ein anderes Thema (Deklaration von Records, hast du schon den crashkurs Delphi von Christian S. gelesen? www.christian-stelzm...rtikel/crashkurs.htm)
Du kannst auch einfach ein "array of string" oder so nehmen.

_________________
Programmers never die, they just GOSUB without RETURN