[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

Set the owner

In my vcl I create a Tcollection alike:

constructor TgnCollection.Create(AOwner: TgnVCL);
begin
  inherited Create(TgnCollectionItem);
  FOwner := AOwner;
end;


How to sent my owner to TgnCollectionItem ???
0
ginsonic
Asked:
ginsonic
  • 2
1 Solution
 
LRHGuyCommented:
When you create a collection item, you pass it the collection that it belongs to, like so:

C:=tCollection.Create;
I:=tCollectionItem.Create(C);

In effect, C is the owner of I.

If C has a property of Owner, then I can access that property with  I.Collection.Owner

Is that what you were looking for?
0
 
ginsonicAuthor Commented:
I was so close ;) I played with this but don't know whay first time don't work.

Thanks for support !
0
 
ginsonicAuthor Commented:
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now