[Lazarus] Saving user created component structure to LFM file

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Jan 12 12:42:35 CET 2009


On Mon, 12 Jan 2009 10:57:20 +0000
Martin Friebe <lazarus at mfriebe.de> wrote:

>[...]
> Thanks, I think I found a better way.
> 
> The outer container has no nested components of it's own. It seems I
> can hook into (override) TComponent.WriteState which is calling 
> WriteComponentData (properties, then Children). Since no children are 
> there, I can make my own calls to WriteComponent from there,
> supplying all the components, of all the helper objects.
> 
> On Read, I can Hook into ReadState. I can let the reader add them 
> normally, and sort them out/once they have been read by the reader.
> 
> The remaining question is: Does that look like something that will
> stay compatible with future code? The generated LFM file definitely
> looks like any LFM file (it has a component, with properties first
> then other nested Components)

To store a property that is a component and which is not owned by the
Lookuproot (form, datamodule, frame) you must set the csSubComponent
flag in ComponentStyle.

To store a list use TCollection. If you can not use TCollection please
explain why not.

To store data of arbitrary length/format, use DefineProperties. This
has a drawback: In case of an error the IDE can not help fixing it.


Mattias



More information about the Lazarus mailing list