If the second form will not be destroyed before program end disable <secondwindow>.options fo_autoreadstat and fo_autowritestat, create the second form before the main form:
- Код: Выделить всё
application.createform(tsecondform,secondform);
application.createform(tmainfo,mainfo);
application.run;
If the second form will be created and destroyed in program lifetime use an additional tstatfile for the second form, activate <secondstatfile>.options sfo_memory, set <secondstatfile>.filename to 'second.sta'. <secondstatfile> now loads and stores from/to an independent internal MSEgui named memory stream (see tmemorystreams in lib/common/kernel/msestat.pas).
In order to save memory files of additional tstatfile's in the main statfile set <mainstatfile>.savedmemoryfiles to '*.sta'.
The main form must exist before creating the additional forms:
- Код: Выделить всё
application.createform(tmainfo,mainfo);
application.createform(tsecondform,secondform);
application.run;
For big applications it is recommended to use a data module for globally used components instead to place them in the main form.