Forum > Other

Load/Save form state to file

(1/2) > >>

koko:
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:
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:
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:
I think you are looking for this:

http://wiki.lazarus.freepascal.org/TXMLPropStorage

koko:
That's it!
Thank you very much.

Navigation

[0] Message Index

[#] Next page

Go to full version