[Lazarus] Examples of IniPropStorage?

Luca Olivetti luca at wetron.es
Sat Feb 21 19:06:00 CET 2009


En/na David W Noon ha escrit:
> Hi all,
> 
> Are there any examples of the usage of TIniPropStorage objects? I have
> searched the examples supplied with Lazarus, but could find none.
> 
> If there are none, could somebody please give me a quick sample they
> have knocked up for their own use? Thanks in advance.
> 


Drop a TIniPropStorage on the form, let's call it FormStorage.
Put all properties you want to preserve in the form SessionProperties 
(there's a nice dialog to add what you want).
If you know beforehand the location of the .ini file, just set it in the 
TIniPropstorage at design time, otherwise assign it in FormCreate.
Also in FormCreate call restore.
When you want to save, just call save, e.g.:

procedure TSettingsForm.FormCreate(Sender: TObject);
begin
   FormStorage.IniFileName:=SettingsFilename;
   FormStorage.Restore;
end;

procedure TFormAjustes.SaveButtonClick(Sender: TObject);
begin
   FormStorage.Save;
end;


Bye
-- 
Luca



More information about the Lazarus mailing list