?
Solved

Set the owner part II

Posted on 2004-10-10
6
Medium Priority
?
187 Views
Last Modified: 2013-11-23
My VCL have a TCollection property. The structure is:

TgnCollection1 = class(TCollection)
....
constructor TgnCollection1.Create(AOwner: TMyVCL);
begin
  inherited Create(TgnCollectionItem1);
...


TgnCollectionItem1 = class(TCollectionItem)
...
inherited Create(Collection); // in my case Collection1
FCollection2 := TgnCollection2.Create(Self);
...

in CollectionItem1 I have a TCollection property, too ( collection in Collection )

TgnCollection2= class(TCollection)
...
inherited Create(TgnCollectionItem2);
...
TgnCollectionItem2 = class(TCollectionItem)
...
inherited Create(Collection); // in my case Collection2
...

Now my problem.

Starting from myVCL I can get the Owner untill the first TCollectionItem with:

FOwner:=Self.Collection.Owner;

How to get the Owner to the last TCollectionItem ?

I wish to know the Owner ( Self .. myVCL ) into TCollectionItem2.




0
Comment
Question by:ginsonic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 7

Expert Comment

by:LRHGuy
ID: 12272048
If SELF is a collectionitem, and you want the collection of that item:

Self.Collection

Now, you want the first item in that collection:

Self.Collection.Items[0]

And that item has it's own collection:

Self.Collection.Items[0].Collection

Which, if that collection also has an owner, should be:

Self.Collection.Items[0].Collection.Owner

Is that what you want?
0
 
LVL 9

Author Comment

by:ginsonic
ID: 12273842
Dont't work :(
0
 
LVL 9

Author Comment

by:ginsonic
ID: 12273844
Self is now the second TCollectionItem
0
 
LVL 9

Author Comment

by:ginsonic
ID: 12273868
Done myself. I added a property to the first CollectionItem where I store the owner. Then just read with

  TgnCollectionItem1(Self.Collection.Owner).Owner;

Thanks!
0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 12321181
Question answered by asker or dialog valuable.
Closed, 500 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question