![]() |
Re: Komponenten-Entwcilung: xyz[i].name
Hallo,
klar geht das. Da Du aber scheinbar Deinen Source nicht posten willst müsste ich jetzt ein Beispiel selber machen. Also bitte zeige Deinen Source |
Re: Komponenten-Entwcilung: xyz[i].name
Danke für deine Hilfe, hier mal der Source:
Code:
type tcontactitem = class
private Fname: string; procedure Setname(const Value: string); public property name: string read Fname write Setname; end; type tContactItemList = class(TList) private function GetItems(Index: Integer): tcontactitem; procedure SetItems(Index: Integer; const Value: tcontactitem); public property Items[Index : Integer]: tcontactitem read GetItems write SetItems;default; end; type Toutextract = class(TComponent) private procedure SetOutlookVersion(const Value: outlookversion); function Getcontacts(Index: Integer): TContactItemlist; procedure Setcontacts(Index: Integer; const Value: TContactItemlist); protected public constructor create(AOwner: TComponent); override; destructor destroy; property contacts[Index : Integer]: TContactItemList read Getcontacts write Setcontacts; end; |
Re: Komponenten-Entwcilung: xyz[i].name
Hallo,
da scheint so einiges durcheinander zu sein. Ich bastel Dir mal ein Beispiel. Bis gleich. |
Re: Komponenten-Entwcilung: xyz[i].name
Liste der Anhänge anzeigen (Anzahl: 1)
Hallo,
studiere mal das Beispiel |
Re: Komponenten-Entwcilung: xyz[i].name
Ich steh anscheinend grad auf dem Schlauch da ich es immer noch nicht hinbekomme:
Habe jetzt das hier:
Code:
Also
type tcontactitem = class
private Fname: string; public property name: string read Fname write Fname; end; type Toutextract = class(TComponent) private FList : TList; function Getcontacts(Index: Integer): TContactItem; function GetCount: Integer; procedure Setcontacts(Index: Integer; const Value: TContactItem); public constructor create(AOwner: TComponent); override; destructor destroy;override; property contacts[Index : Integer]: TContactItem read Getcontacts write Setcontacts; default; property Count : Integer read GetCount; end;
Code:
klappt jetzt, leider aber auch
Komponente.contacts[i].name
Code:
Warum?
Komponente.contacts.name
Ausserdem sollte
Code:
funktionieren, es geht natürlich nicht sondern nur
komponente.contacts.count
Code:
aber wo soll ich denn sonst diese Deklaration hintun? Ich will ja auch nicht
komponente.count
Code:
Danke für deine Geduld und Mühe
contacts[1].count
lkz633 |
Re: Komponenten-Entwcilung: xyz[i].name
Zitat:
Count property hat. Zitat:
Wenn Du Deinen Code komplett (also mit Methoden usw) posten würdest schau ich mir das noch einmal an. |
Re: Komponenten-Entwcilung: xyz[i].name
Zitat:
Ich würde also gerne sowohl
Code:
als auch
Komponnete.contacts[i].name;
Code:
erreichen.
Komponente.contacts.count
Geht dies dann gar nicht? Gruss lkz633 |
Re: Komponenten-Entwicklung: xyz[i].name
Hallo,
da Du keine Source rausrückst muss ich jetzt mit meinen Beispiel kommen
Delphi-Quellcode:
Der Trick ist , in jedem TMyListItem sich den entsprechenden TMyListItems zu merken.
TMyListItems = class;
TMyListItem = class(TObject) private function GetCount: Integer; private FName: String; FMyListItems : TMyListItems; public constructor Create(MyListItems : TMyListItems); property Count : Integer read GetCount; property Name : String read FName write FName; end; ... function TMyListItems.Add(const aName : String): TMyListItem; begin Result:=TMyListItem.Create(Self); Result.Name:=aName; FList.Add(Result); end; ... function TMyListItem.GetCount: Integer; begin If Assigned(FMyListItems) then Result:=FMyListItems.Count else Result:=-1; // Zeigt dass das TMyListItem in keiner Liste hängt end; |
Re: Komponenten-Entwicklung: xyz[i].name
Aber dann kann ich doch immer noch nicht contacts.count machen oder?
Hier mein Code(mehr hab ich seit 3 Stunden nicht zustandegebracht :wall: )
Code:
type tcontactitem = class
private Fname: string; public property name: string read Fname write Fname; end; type Toutextract = class(TComponent) private FList : TList; function Getcontacts(Index: Integer): TContactItem; function GetCount: Integer; procedure Setcontacts(Index: Integer; const Value: TContactItem); public constructor create(AOwner: TComponent); override; destructor destroy;override; property contacts[Index : Integer]: TContactItem read Getcontacts write Setcontacts; default; property Count : Integer read GetCount; end; |
Re: Komponenten-Entwicklung: xyz[i].name
Hallo,
Du hast mich immer noch nicht verstanden. Ich möchte die komplette unit !!! Auch den Code für die Methoden !!! D.h. ich möchte z.B. sehen wie Du den Setter Setcontacts realisiert hast. Damit das ganze mal richtig testen kann. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:28 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz