[Lazarus] Something goes wrong while streaming nested components
Kiên Nguyễn Tiến Trung
kc97ble at gmail.com
Sat Oct 17 10:18:12 CEST 2015
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.*
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.
-------------------------------------
Please download the attachment to see how it acts. The way to reproduce is
described as following:
1. Press RandButton, then press ShowButton, the message should look like
this:
Parent: Value=54, Str=SP, List=PV, ComponentCount=1
Child: Value=85, Str=WO, List=QL, ComponentCount=0
2. Press SaveButton
3. Close the form and reopen it.
4. Press LoadButton, then press ShowButton, the message should look like
this:
Parent: Value=54, Str=SP, List=PV, ComponentCount=2
Child: Value=0, Str=, List=, ComponentCount=0
(What I expected is
Parent: Value=54, Str=SP, List=PV, ComponentCount=1
Child: Value=85, Str=WO, List=QL, ComponentCount=0)
I spent about 12 hours to find out the proper way but I failed.
Please help me. Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20151017/d60bfb1f/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: streaming_components.zip
Type: application/zip
Size: 3999 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20151017/d60bfb1f/attachment-0002.zip>
More information about the Lazarus
mailing list