Saving and restoring the state of a form at run-time, anyone? lazarus / 31-LCL ---------------------------------------------------------------------- EganSolo · 2021-12-24 05:52 I have an app with many forms and I would like to save and restore the state of that app, which means saving and restoring the state of each form. I can certainly write the code to do that but wanted to check and see if that's been done already. Thanks for any feedback. ---------------------------------------------------------------------- af0815 · 2021-12-24 08:05 What is the understanding of 'state of the form' ? Do you want this https://wiki.freepascal.org/TXMLPropStorage ? ---------------------------------------------------------------------- zoltanleo · 2021-12-24 08:22 Quote from: EganSolo on December 24, 2021, 06:52:09 amI have an app with many forms and I would like to save and restore the state of that app, which means saving and restoring the state of each form. I can certainly write the code to do that but wanted to check and see if that's been done already. Thanks for any feedback. I recommend JSON Tools for Pascal (https://forum.lazarus.freepascal.org/index.php/topic,46533.0.html) ---------------------------------------------------------------------- jcmontherock · 2021-12-24 15:58 For me: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.SaveParms;var  FS:         TFileStream;  Writer:     TWriter;  FormRect:   TRect;  sFilename:  String;begin  sFilename := ExtractFilePath(ParamStr(0)) + ChangeFileExt({$I %FILE%}, '.parm');  FS := TFileStream.Create(sFilename, fmCreate);  Writer := TWriter.Create(FS, 1024); // Buffer size 1024  FormRect := Bounds(Form1.Left, Form1.Top, Form1.Width, Form1.Height);  Writer.Write(FormRect, SizeOf(FormRect));  Writer.WriteInteger(Integer(Form1.WindowState));  Writer.Free;  FS.Free;end; procedure TForm1.ReadParms;var  FS:         TFileStream;  Reader:     TReader;  FormRect:   TRect;  sFilename:  String;begin  sFilename := ExtractFilePath(ParamStr(0)) + ChangeFileExt({$I %FILE%}, '.parm');  if FileExists(sFilename) = False then Exit;  FS := TFileStream.Create(sFilename, fmOpenRead);  Reader := TReader.Create(FS, 1024);  Reader.Read(FormRect, SizeOf(FormRect));  Form1.SetBounds(FormRect.Left, FormRect.Top, FormRect.Width, FormRect.Height);  Form1.WindowState := TWindowState(Reader.ReadInteger);  Reader.Free;  FS.Free;end;