[fpc-pascal] streaming child components
Roland Schaefer
roland.schaefer at fu-berlin.de
Sun Oct 25 21:56:01 CET 2009
Hi,
I have another question regarding serialization. I need to stream child
components, and here: http://wiki.freepascal.org/Streaming_components it
says that "TComponent extends TPersistent by the ability to have child
components". The rest I figured from reading the RTL sources, and I'm
wondering if I'm using a suboptimal solution, since I don't really use
anything built into TComponent besides overriding one method which is
empty in TComponent.
What I'm doing is I have my TComponent descendants keep a TComponentList
of children (which are not necessarily owned by the parent), and then I
overwrite the GetChildren(Proc ...) method and have it call Proc for
every child in the list. I also introduce a private FParent field which
I set manually when a component becomes the child of another component.
Is that reinventing the wheel (probably with a flat tire), or should/can
you do it this way?
Cheers, thanks a lot
Roland
More information about the fpc-pascal
mailing list