On Sunday 08 July 2018 13:50:41 fredvs wrote:
> Hello Martin.
>
> Is it possible to use sta files to save/load a layout at runtime.
>
> The result of using a sta file is perfect while closing-running a program.
>
> But is it possible to save at runtime the layout (with a custom name for
> the sta file) and then reload it when needed ?
>
Yes, call tstatfile.writestat() and readstat().

> If all this is possible, could you give some code explaining how to do ?
>
See the signatures:
"
   procedure readstat(const stream: ttextstream = nil); overload;
   procedure readstat(const afilename: filenamety); overload; //disk file

   procedure writestat(const stream: ttextstream = nil); overload;
   procedure writestat(const afilename: filenamety); overload; //disk file
"

> Is it possible to save/load a sta file only for one form (saving for
> example a grid-entry) ?
>
Yes, tstatfile saves/loads only components where the statfile property is set 
to the given tstatfile. If loading/saving should work automatically select 
the tstatfile into the statfile property of the form.
What also often is used are sub-statfiles for individual forms which 
load/store from memory files by activating sfo_memory and a main statfile 
which writes the memory files to disk by entering a filenamemask for the 
memory files in the main tstatfile.savedmemoryfiles, for example *.sta if all 
memory statfiles have the ".sta" extension.

Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to