Thanks Rob,

I did have a get and set method in the FirstItem for the Second
Collection in the actual code, but I spent some time with breakpoints
set in the Get method, and the FirstCollection was nil sometimes (not
all the time). I put a statement in that reads like if FirstCollection =
nil then Create It. 

It doesn't seem intuitive to me to have to do that (and I've written
hundreds of components), and the documentation specifically says not to
call the Create method of a Collection Item, so I was trying to avoid
it, but perhaps that is not meant as an absolute because it does seem to
be necessary to do it when a Collection is embedded in a Collection
Item. 

I think what I really need to create is a TOwnedCollectionItem so that
the item will always know it's owner component, the way the owned
collection does. 

I'm doing this project in a trial version of d2007 and I don't have the
source code for the Collection and CollectionItems. It would probably
help quite a bit. I've looked through D7 source code, but there have
been changes since then.

Anyway, thanks for the help. It did point me in the right direction. 
 

Sincerely,

Brad Gies
-------------------------------------
NLM Software
Southfield, MI, USA
------------------------------------- 

If you get today's work done today, but do it in a way that you can't
possibly get tomorrow's work done tomorrow, then you lose. 

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:delphi-talk-
> [EMAIL PROTECTED] On Behalf Of Rob Kennedy
> Sent: Thursday, September 04, 2008 12:21 PM
> To: Delphi-Talk Discussion List
> Subject: Re: Using TOwnedCollection
> 
> Gies,Brad wrote:
> > MySecondCollectionItem = class(TCollectionItem)
> > Private
> >   FAnotherValue = integer
> > Published
> >   Property AnotherValue : integer read FAnotherValue write
> > FAnotherValue;
> > End;
> >
> > MySecondCollection = class(TOwnedCollection)
> >   // all the properties.
> > End;
> >
> > MyFirstCollectionItem = class (TCollectionItem)
> > private
> >   fsomeValue : integer;
> >   fSecondCollection : TSecondCollection;
> > published
> >   property SomeValue : integer read fsomeValue write fsomeValue;
> >   property SecondCollection : TSecondCollection
> >               read fSecondCollection
> >               write fSecondCollection;
> > end;
> 
> That's not how to write a property for an object type that's meant to
be
> operated by the Object Inspector.
> 
> Give the property a setter method, and in that method, copy the
contents
> of the input object to the internal one.
> 
> This means your TFirstCollectionItem will need to have a constructor
> where it creates itself an instance of TSecondCollection. (And the
> corresponding destructor.)
> 
> > This e-mail or communication, including any attachments, is intended
> only for the person or entity
> > to which it is addressed and may contain confidential and/or legally
> privileged material.  Any review,
> > retransmission, dissemination or other use of, or taking of any
action
> in reliance upon, this
> > information by persons or entities other than the intended recipient
is
> prohibited.  If you received
> > this message in error, please contact the sender immediately and
> permanently delete all copies,
> > electronic or other, you may have or from your computer. Any
disclosure,
> copying, distribution,
> > reliance or use of the contents or information received in error is
> strictly prohibited.
> > The foregoing applies even if this notice is imbedded in a message
that
> is forwarded or attached.
> 
> Ugh. Are you and your employer aware that your messages are archived
on
> a public Web site?
> 
> --
> Rob
> __________________________________________________
> Delphi-Talk mailing list -> [email protected]
> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk


This e-mail or communication, including any attachments, is intended only for 
the person or entity
to which it is addressed and may contain confidential and/or legally privileged 
material.  Any review,
retransmission, dissemination or other use of, or taking of any action in 
reliance upon, this
information by persons or entities other than the intended recipient is 
prohibited.  If you received
this message in error, please contact the sender immediately and permanently 
delete all copies,
electronic or other, you may have or from your computer. Any disclosure, 
copying, distribution,
reliance or use of the contents or information received in error is strictly 
prohibited.
The foregoing applies even if this notice is imbedded in a message that is 
forwarded or attached.
__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk

Reply via email to