Autor Beitrag
kingflo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37


D6
BeitragVerfasst: Fr 03.11.06 13:36 
Hallo...
ich habe mal eine frage, gibt es in delphi eine Möglichkeit ein Array so ähnlich wie in PHP zu benutzen?

also z.B

array[i]['key']:=value;

usw...

?

ich möchte mir nämlich keinen Typen erstellen, da es auch andere nicht vordefinierte keys sein können.
damit z.B auch folgendes möglich ist

array[1][edit1.text]:='ws weiß ich';

geht das irgendwie?
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Fr 03.11.06 13:39 
Schau Dir mal TStringList.Values an.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
kingflo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37


D6
BeitragVerfasst: Fr 03.11.06 13:59 
bei StringList.values kann ich aber doch keinen integer mit angeben?

also z.B list.values[key] geht natürlich super, aber list.values[1][key] geht ja nicht...
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Fr 03.11.06 14:02 
Dann mach doch ein Array of TStringlist:
ausblenden Delphi-Quelltext
1:
MyStringlist[i].Values[Key]					

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
kingflo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37


D6
BeitragVerfasst: Fr 03.11.06 14:05 
argghh ne geht nicht objekt oder Klassentyp erforderlich...
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Fr 03.11.06 14:33 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var
  SList: Array[0..1of TStringList;
begin
  SList[0] := TStringList.Create;
  SList[0].Values['Bla'] := 'Bla';

Das geht bei mir aber.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
kingflo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37


D6
BeitragVerfasst: Fr 03.11.06 14:38 
ja so geht es danke.... danke