Solved

Set the owner part II

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tviruailstringtree sort multi columns on header click 1 63
Delphi: Connect to running MS Outlook 4 87
Base1 Encode/Decode 3 77
Breakpoint doesn't stop in my variable 3 28
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

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