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
> 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.
On Tuesday 10 July 2018 14:04:40 fredvs wrote:
> By the way, do you have some idea (+code) how to move a row, with the
> mouse, inside the tstringgrid ?
The grid must have a fixed column. Please activate <grid>.optionsgrid
og_rowmoving. Drag the row by clicking into the fixed column.