On Tue, 19 Feb 2013 18:54:53 +1100
Александр С. <[email protected]> wrote:

> >You have to know the units where the class declarations reside
> 
> Here is an example LFM-file:
> 
> object Form1: TForm1
>   Left = 224
>   Height = 240
>   Top = 146
>   Width = 320
>   Caption = 'Form1'
>   ClientHeight = 240
>   ClientWidth = 320
>   LCLVersion = '1.0.6.0'
>   object Memo1: TMemo
>     Left = 36
>     Height = 121
>     Top = 78
>     Width = 146
>     Lines.Strings = (
>       'Memo1'
>     )
>     TabOrder = 0
>   end
>   object ProgressBar1: TProgressBar
>     Left = 46
>     Height = 24
>     Top = 24
>     Width = 240
>     TabOrder = 1
>   end
>   object SpinEdit1: TSpinEdit
>     Left = 207
>     Height = 21
>     Top = 160
>     Width = 84
>     TabOrder = 2
>   end
>   object SelectDirectoryDialog1: TSelectDirectoryDialog
>     left = 210
>     top = 91
>   end
> end
> 
> How can I get the units where the class declarations reside, knowing
> only this information? When I loading the LFM-file, I know LFM content
> only.

Dodi probably meant the "Register" procedures. They register the
LCL classes via RegisterComponents. But some do more than this. They
are used by the IDE.
You don't need the units, you need to register all needed classes or
provide a OnFindClass hook, as shown in the example.

 
> > Have you seen the example in lazarus/examples/componentsstreaming/ ?
> 
> Yes, I have. This example is incorrect in my case, because:
> 1)    No need to register classes -- everything is already registered
> 2)    The process of copying the component is performed in the example.
> In my case it happens with Forms; and it is not copied -- replacement.

You can not replace with lfm. lfm only adds components or sets
properties.
ReadComponentFromBinaryStream can read forms too.
Alternatively you can use TReader.ReadRootComponent.
 
> > See the example
> 
> Unfortunately, he could not help me in this case, it is too simple.

Here is a complex example:
lazarus/designer/jitforms.pp
Search for AddJITComponentFromStream.

Mattias

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to