[Lazarus] How to load the Form from LFM-file at run time?

Александр С. sss0991 at gmail.com
Tue Feb 19 08:54:53 CET 2013


>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.

> 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.

> See the example

Unfortunately, he could not help me in this case, it is too simple.




More information about the Lazarus mailing list