[Lazarus] Saving user created component structure to LFM file

Martin Friebe lazarus at mfriebe.de
Mon Jan 12 15:11:01 CET 2009


So as I see it I found 2 possibilities
> 1) The GutterParts are created as components owned by the SynEdit (or 
> does it have to be the form; if it does have to be the form then there 
> will be issues if there is more than one synedit.... ). that will be a 
> lot of easy to break maintenance work. because you need to search 
> through the component list to find the Objects.
> And when loading I still need to remove the Objects created in 
> Synedit.Create or I get double entries.
> - Also I tried it, and SynEdit did not seem to stream them (MyGutterPart 
> := TcomponentBasedClass.Create(TheSynEditAsOwner);) => nothing in the lfm
>
> 2) Maintain the objects as they are, but use SynEdit.WriteState to 
> append them to the lfm
>   (They can easily be caught, if they get read (by the default reader) 
> during loading
>
>   
There may be a 3rd way.
Inside TWriter.WriteChildren is a call to 
TComponent.GetChildren(RefToWriteComponetn, RootComponnet)

This is used in TControl and TFrame and others to return (one by one, 
via callback) all the children that should be written.

That is probably the best place to go; Only I was/am not sure, if this 
is used explicitly for the Component serialization?

Martin




More information about the Lazarus mailing list