Autor Beitrag
Yacoon
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72



BeitragVerfasst: Do 20.02.03 11:56 
Ich habe ein Problem mit der TObjectList. Ich kann auf die Objekte die ich in die ObjectList geadded habe nicht mehr drauf zugreifen. Mit Items kann ich ja auf die Objekte zugreifen. Steht so in der Hilfe.

ausblenden Quelltext
1:
ObjektListe.Items[Index]					


So greife ich auf meine Objekte zu. Also müsste doch, wenn ich nach dem INdex ein Punkt mache, direkt aif mein Objet zugreifen können. Also das müsste doch dann so aussehen, oder?

ausblenden Quelltext
1:
ObjektListe.Items[Index].MeineFunktion();					


Das geht so aber nicht! Kann mir da vielleicht jemand helfen, wie ich auf meine Objekt zugreife?

Danke schonmal im Vorraus[/code]
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 20.02.03 12:02 
Hallo

weil in der Objektliste die Items vom Typ objekt sind

ausblenden Quelltext
1:
2:
3:
4:
5:
//Typprüfung zur sicherheit
if ObjektListe.Items[Index]=TMeinobjekt then
  TMeinObjekt(ObjektListe.Items[Index]).meinefunktion
oder
  (ObjektListe.Items[Index] as TMeinobjekt).meinefunktion


mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Yacoon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72



BeitragVerfasst: Do 20.02.03 12:07 
Achso, danke für die schnelle Antwort!

Gruß