On Mon, 18 Feb 2013 22:49:55 +1100 Александр С. <[email protected]> wrote:
> 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() Have you seen the example in lazarus/examples/componentsstreaming/ ? > These methods have drawbacks: > a. Double-clicking event from the old form doesn't disappear in new When you load a lfm you have to start with a newly created form. There is no method to "reset" a form to its initial state. > 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))" ? See the example. > 3. File -> StringStream -> Reader -> Reader.ReadComponent -> > InsertComponent > But my methods does not work. Could you please help me: how to load > Form from LFM-file at run time? Mattias -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
