Александр С. schrieb:
Example: there is a empty form that has an event: another form (from
LFM-file) to be loaded instead of this form by double-clicking on old
form at run time.
I tried several ways to do this, for example:
1. File -> FileStream -> BinStream -> BinStream.ReadComponent(Form)
2. ReadComponentResFile()
I'm using (2) in an old Delphi program.
These methods have drawbacks:
a. Double-clicking event from the old form doesn't disappear in new
I create a new (empty) form.
b. Need to register (RegisterClasses) for all the classes that are in
the new form. Parsing the LFM-file, you can get the names of classes
in the strings. What content should have a function "function
StringToClass(AStr: string): TClass", to be able to call
"RegisterClass(StringToClass(AStr))" ?
You have to know the units where the class declarations reside, and Use
them in the registering unit. Then register all classes by name.
When you design the forms, you have all informations at hand. Later you
can exclude the .pas files, when you only want to load the lfm files.
DoDi
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus