[Lazarus] Something goes wrong while streaming nested components

Kiên Nguyễn Tiến Trung kc97ble at gmail.com
Mon Oct 26 16:28:45 CET 2015


Thank you.
Vào 18-10-2015 22:11, "Mattias Gaertner" <nc-gaertnma at netcologne.de> đã
viết:

> On Sat, 17 Oct 2015 15:18:12 +0700
> Kiên Nguyễn Tiến Trung <kc97ble at gmail.com> wrote:
>
> > I have been successful to save a component to a text file. However, I
> have
> > a problem while reading them back.
> >
> > To illustrate, this is the text file created by saving the components.
> >
> > object Parent1: TParentClass
> >   Child = Child
> >   Value = 54
> >   Str = 'SP'
> >   List.Strings = (
> >     'PV'
> >   )
> >   object Child: TChildClass
> >     Value = 85
> >     Str = 'WO'
> >     List.Strings = (
> >       'QL'
> >     )
> >   end
> > end
> >
> > When I load the component Parent1 using this file, properties Value, Str,
> > and List are loaded successfully. *However, the property Child is not
> > loaded.*
>
> Actually it is created and loaded.
>
>
> > It seems that there is a TChildClass object created and then increases
> the
> > ComponentCount of Parent1. But it is not what I want. I want the property
> > Child be loaded instead of creating a new object.
>
> If I remember correctly you need
>
> Child.ComponentStyle:=Child.ComponentStyle+[csSubComponent];
>
>
> Mattias
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20151026/7bb21769/attachment-0003.html>


More information about the Lazarus mailing list