[Lazarus] Something goes wrong while streaming nested components
Mattias Gaertner
nc-gaertnma at netcologne.de
Sun Oct 18 17:11:37 CEST 2015
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
More information about the Lazarus
mailing list