Recent

Author Topic: Load/Save form state to file  (Read 7279 times)

koko

  • New Member
  • *
  • Posts: 19
Load/Save form state to file
« on: May 08, 2007, 06:35:59 pm »
Hi all,
What's the easiest way to 'dump' a form state to a file in lazarus?
It would be very useful to save/load settings runtime for -say- a gui for a commandline only executable.

thanks!

CCRDude

  • Hero Member
  • *****
  • Posts: 614
RE: Load/Save form state to file
« Reply #1 on: May 08, 2007, 10:36:54 pm »
While Delphi is usually called a RAD - rapid doesn't mean that one shouldn't separate function and user interface, and Lazarus isn't Delphi. If you code properly separated, you don't have any "gui" that you need to load/save settings from/to.

koko

  • New Member
  • *
  • Posts: 19
RE: Load/Save form state to file
« Reply #2 on: June 26, 2007, 07:36:22 pm »
I did not understand why do you mention Delphi.
I was trying to make a 'graphical interface' for mplayer, which you know, has tons of settings, which means tons of knobs, scrollbars and so on.
When the user has found his perfect configuration for - say - a DVD video, another for an HDTV, another for a bad xvid and wants to save his settings to a file, he just name that preset and press save.
At that point, i should 'parse the state' of my form (or keep track of, someway) entry by entry (checkboxes, text entries, scrollbars) , and then i should format that data somehow and dump it to a file.
Inverse operation whould be needed when the user press "load".

You can clearly understand that as the number of options keeps growing, the code will grow so, and mplayer is FULL of options.

Do you understand what i mean? Is there a faster way to 'dump' a form state to a file?
Thank you.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
RE: Load/Save form state to file
« Reply #3 on: June 27, 2007, 07:43:27 am »

koko

  • New Member
  • *
  • Posts: 19
Load/Save form state to file
« Reply #4 on: August 10, 2007, 12:05:24 pm »
That's it!
Thank you very much.

GabrielMoraru.com

  • Newbie
  • Posts: 3
Re: Load/Save form state to file
« Reply #5 on: February 18, 2025, 08:19:09 pm »
I have a library (LightSaber on GitHub, Freeware) that allows you to save/load all the controls on a form, to disk, with almost no code (4 lines more exactly).
https://www.youtube.com/watch?v=a9nZiDXYmIo

« Last Edit: February 18, 2025, 08:21:24 pm by GabrielMoraru.com »

 

TinyPortal © 2005-2018