Solved

Set the owner part II

Posted on 2004-10-10
6
179 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
  • 3
6 Comments
 
LVL 7

Expert Comment

by:LRHGuy
Comment Utility
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
Comment Utility
Dont't work :(
0
 
LVL 9

Author Comment

by:ginsonic
Comment Utility
Self is now the second TCollectionItem
0
 
LVL 9

Author Comment

by:ginsonic
Comment Utility
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
Comment Utility
Question answered by asker or dialog valuable.
Closed, 500 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now