Solved

Set the owner part II

Posted on 2004-10-10
6
185 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

Industry Leaders: 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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

690 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