View Issue Details

IDProjectCategoryView StatusLast Update
0005318JEDI VCL00 JVCL Componentspublic2010-09-06 15:42
ReporterdigoniAssigned Tojfudickar 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.39 
Target VersionFixed in Version 
Summary0005318: TJvFormStorage not save at runtime
DescriptionHi,

I have a TJvFormStorage (JvFormStorage1) on my form (fxBase), and at runtime i added StoredProps of some components.
When i open the INI file, everything is fine excepts the StoredProps dont write, even, when the form is opened, the properties are not loaded.

How can i add StoredProps at runtime to load and save it ??

Some piece of code:

procedure TFxBase.FormCreate(Sender: TObject);
begin
   for I := 0 to pred(ComponentCount) do begin
      if (Components[I] is TJvDBGrid) then begin
         TJvDBGrid(Components[I]).IniStorage := JvFormStorage1;
         TJvDBGrid(Components[I]).Columns.State := csCustomized;
         JvFormStorage1.StoredProps.Append(TJvDBGrid(Components[I]).Name+
                                           '.AlternateRowColor');
         JvFormStorage1.StoredProps.Append(TJvDBGrid(Components[I]).Name+
                                           '.RowHeight');
         JvFormStorage1.StoredProps.Append(TJvDBGrid(Components[I]).Name+
                                           '.FixedCols');
      end;
   end;
end;
Additional InformationAttached an example to reproduce the problem.
TagsNo tags attached.

Activities

2010-09-01 16:38

 

Test-JvFormStorage.zip (620,160 bytes)

jfudickar

2010-09-06 01:26

developer   ~0017652

Hi,

this is a problem of your timing.
Placing this code in the onCreate event didn't work, because when loading the dfm file into memory the contents of the StoredProps is resetted to the values in the dfm file.

Change your code and place the definition into the overloaded procedure "Loaded". This procedure is executed after the dfm file is loaded.

Please inform us when the problem is solved.

Kind Regards
Jens
  TForm1 = class(TForm)
    JvFormStorage1: TJvFormStorage;
    JvAppIniFileStorage1: TJvAppIniFileStorage;
    JvDBGrid1: TJvDBGrid;
  private
    { Private declarations }
  protected
    procedure Loaded; override;
  public
    { Public declarations }
  end;

procedure TForm1.Loaded;
var
   I : Integer;
begin
  inherited;
   for I := 0 to pred(ComponentCount) do begin
      if (Components[I] is TJvDBGrid) then begin
         TJvDBGrid(Components[I]).IniStorage := JvFormStorage1;
         TJvDBGrid(Components[I]).Columns.State := csCustomized;
         JvFormStorage1.StoredProps.Append(TJvDBGrid(Components[I]).Name+
                                           '.AlternateRowColor');
         JvFormStorage1.StoredProps.Append(TJvDBGrid(Components[I]).Name+
                                           '.RowHeight');
         JvFormStorage1.StoredProps.Append(TJvDBGrid(Components[I]).Name+
                                           '.FixedCols');
      end;
   end;
// ShowMessage(JvFormStorage1.StoredProps.Text);
end;

digoni

2010-09-06 15:31

reporter   ~0017654

Thanks for reply, ive putted the code on TForm1.Loaded then now it works perfectly.

How can i change this thred status to "done" ??

jfudickar

2010-09-06 15:42

developer   ~0017655

Done :-)

Issue History

Date Modified Username Field Change
2010-09-01 16:38 digoni New Issue
2010-09-01 16:38 digoni File Added: Test-JvFormStorage.zip
2010-09-06 01:26 jfudickar Note Added: 0017652
2010-09-06 01:26 jfudickar Status new => feedback
2010-09-06 15:31 digoni Note Added: 0017654
2010-09-06 15:42 jfudickar Note Added: 0017655
2010-09-06 15:42 jfudickar Status feedback => resolved
2010-09-06 15:42 jfudickar Resolution open => fixed
2010-09-06 15:42 jfudickar Assigned To => jfudickar