How to save grid.font.size in inipropstorage (how use TStoredValue) lazarus / 31-LCL ---------------------------------------------------------------------- poiuyt555 · 2013-04-29 14:11 Hi. How to save grid.font.size in inipropstorage (how use TStoredValue)? TStoredValue has properties (i set): Name = Grid_Font_Size Value = StringGrid1.Font.Size KeyString = StringGrid1.Font.Size And size is not saved and not load. How do do it? ---------------------------------------------------------------------- howardpc · 2013-04-29 17:14 Try this. Start a new project, and drop a TStringGrid and a TiniPropStorage component on the form. Add OnCreate and OnClose handlers for the form, and complete them thus: Code: [Select]unit IniPSmain; {$mode objfpc}{$H+} interface uses   Forms, Grids, IniPropStorage; type   { TForm1 }   TForm1 = class(TForm)     ps: TIniPropStorage;     sgrid: TStringGrid;     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);     procedure FormCreate(Sender: TObject);   end; var   Form1: TForm1; implementation uses sysutils; {$R *.lfm} { TForm1 } procedure TForm1.FormCreate(Sender: TObject); begin   ForceDirectories(GetAppConfigDir(False));   ps.IniFileName:=GetAppConfigFile(False, False);   ps.Active:=True;   ps.IniSection:= 'sgrid.Font';   sgrid.Font.Size:=17; end; procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction); begin   ps.StoredValue['sgrid.Font.Size']:= IntToStr(sgrid.Font.Size);   CloseAction:=caFree; end; end. Compile and run the project. Close the main form. Then look for a YourProjectName.cfg file in the appropriate directory for your OS. ---------------------------------------------------------------------- poiuyt555 · 2013-05-04 09:58 Thanks! It works: Code: [Select]FormCreate: IniPropStorage1.StoredValues.Add.DisplayName:= 'GridFontSize'; FormShow: Stringgrid1.Font.Size := StrToIntDef(IniPropStorage1.StoredValue['GridFontSize'], Stringgrid1.Font.Size); FormClose: IniPropStorage1.StoredValue['GridFontSize'] := IntToStr(Stringgrid1.Font.Size);