I have a form with a series of TComboBox
and TEdit
s. I would like that when you click OK, you save that data and when you open that form again, it opens in the same way that you closed it: with all the TComboBox
selected ones, etc...
I work in Delphi with Embarcadero RAD Studio XE6.
I already tried with TFormPlacement
the RX, but either I'm doing something wrong or it doesn't work for me...
There are several ways and/or places to save this type of data:
TIniFile
).TRegistry
).With the RxLib components you mention , you can do it in the registry or in INI files, since they implement both options.
If you want to try doing it by hand, for example using an INI file, you can use a couple of procedures like these.
In the uses of your
unit
add:In the public part of your form add 2 procedures:
The implementation will look something like this:
You will have to add more components in each procedure. As many as you want to store.
Finally, for example, in the
OnShow
one of your form, you should call the procedureRecuperarEstado
, and in theOnClose
one of the forms toGuardarEstado
.In my case, once the state is saved, in the same place where the EXE is generated, an .INI file appears with a content like this:
As you add more components and properties they will be stored in this file.