View Issue Details

IDProjectCategoryView StatusLast Update
0001304JEDI VCL00 JVCL Componentspublic2004-03-09 02:47
ReporteranonymousAssigned Touser72 
PrioritynormalSeverityblockReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0001304: TJvFormStorage/TJvAppIniFileStorage delete Sections
DescriptionIf I try to save the property "TComboBox.Items" all existing Sections will be deleted from the IniFile.

Ingo
TagsNo tags attached.

Activities

jfudickar

2004-01-25 15:21

developer   ~0002828

Hi Ingo,

is it possible to get a little bit more on informations. Maybe an sample application.

Greetings
Jens

2004-01-29 04:47

 

Storage.zip (3,284 bytes)

anonymous

2004-01-29 04:48

viewer   ~0002865

Hi Jens,

Seee the attached sample application.
Open Test.ini and notice the three Sections:
Section1,Section2 and Section3.

They should be called by another application and never modified
from Test.exe.

-compile and run Test.exe.
-notice the black shape
-click btnSettings
-click btnColor and change the color to red
 the ShapeColor in frmMain is now red
-close the aplication
-restart Test.exe - the ShapeColor is now red
ok - till this point it works!

Open Test.ini again and notice the three Sections:
Section1,Section2 and Section3 - they are still there

-now select SettingsStorage from Unit2 and include
 the property Combobox1.Items to the stored property's

-compile and run Test.exe.

Open Test.ini
the Combobox1.Items are stored but all other sections
are deleted!

Greetings
Ingo

user72

2004-01-29 14:36

  ~0002879

Seems to me that the problem is in TJvPropertyStorage.StoreStringsProperty and TJvPropertyStorage.LoadStringsProperty (in JvPropertyStorage.pas).

I think we need to change the following (in both):

    if Section <> '' then
      SectName := Format('%s.%s', [Section, GetItemName(PropInfo^.Name)])
    else
      SectName := Format('%s', [GetItemName(PropInfo^.Name)]);



I haven't debugged it fully, but it seems AppStorage.OptimizePaths
doesn't like the initial '.' in the section name

user72

2004-01-29 14:37

  ~0002880

Might want to take a quick look through the code to find any other property save/restore functions that exhibit the same problem.

Ingo

2004-01-29 16:31

reporter   ~0002882

With the modified LoadStringsProperty/StoreStringsProperty
it works now. There are a few other Format('%s.%s'... calls which maybe
also make problems. Isn't it better to modify OptimizePaths to handle
the initial '.'? This has the advantage that JVCL 2.x settings can be
restored.

Greetings
Ingo

user72

2004-01-29 18:58

  ~0002884

Do you have an example of the old style ini files with sections containing dots?

2004-01-30 00:21

 

Old_Ini.zip (2,159 bytes)

Ingo

2004-01-30 00:21

reporter   ~0002890

I have uploaded an example which uses JVCL 2.x style settings.
If you change
[Main.Event_Items]
to
[MainEvent_Items]
the Items can be restored.
Note that TJvMRUManager still works with dots.

Greetings
Ingo

user72

2004-01-30 00:56

  ~0002891

Last edited: 2004-01-30 00:57

OK, I've uploaded a fixed version that should be able to store items using the
[Section.Component_Items] syntax. This also updates 0001312

edited on: 01-30-04 00:52

user72

2004-01-30 11:13

  ~0002893

I just tested the OldIni project with the changes I've made and it seems to work OK.

user72

2004-01-30 12:42

  ~0002894

I have found another solution that might work better.

user72

2004-02-01 00:16

  ~0002908

Get the latest version from CVS and let me know if it works or not. The fix is in JvFormPlacement and JvPropertyStorage, JvAppStorage etc has been restored to their previous state

Ingo

2004-02-01 15:26

reporter   ~0002921

I have tested the OldIni project with the latest version from CVS.
The values for Event.Items and TJvMRUManager get restored and saved.

Then I switched to a real project and...it doesn't work.

Back in OldIni project I have made additional tests.
The problem is in the Active property.
To reproduce it - set JvFormStorage1.Active to false.
Insert two manual calls to FormCreate/FormDestroy.

procedure TfrmMain.FormCreate(Sender: TObject);
begin
  JvFormStorage1.RestoreFormPlacement;
end;

procedure TfrmMain.FormDestroy(Sender: TObject);
begin
JvFormStorage1.SaveFormPlacement;
end;

Now you can see:
Event.Items get restored/saved -
but the recent list from TJvMRUManager doesn't.

This also relate:
Changed TJvFormPlacement behavior/Bug ID: 0001312

Greetings
Ingo

user72

2004-02-02 11:07

  ~0002924

Last edited: 2004-02-02 11:10

Seems to be caused by the JvMRUManager checking Storage.IsActive,
which it shouldn't...

I just tested changing all IniStorage.IsActive in JvMRUManager to
Assigned(IniStorage) and that seems to solve it.

edited on: 02-02-04 11:04

user72

2004-02-02 11:20

  ~0002925

I've asked on the newsgroups if it's OK to change the behavior of JvRUManager (and other components using IsActive to initiate save/restore). If it's OK, I'll change it in a day or so.

user72

2004-02-13 14:07

  ~0002935

Seems to be working now

Issue History

Date Modified Username Field Change
2004-01-25 15:21 jfudickar Note Added: 0002828
2004-01-27 23:23 user72 Status new => feedback
2004-01-29 04:47 anonymous File Added: Storage.zip
2004-01-29 04:48 anonymous Note Added: 0002865
2004-01-29 14:36 user72 Note Added: 0002879
2004-01-29 14:37 user72 Note Added: 0002880
2004-01-29 16:06 user72 Status feedback => assigned
2004-01-29 16:06 user72 Assigned To => user72
2004-01-29 16:31 Ingo Note Added: 0002882
2004-01-29 18:58 user72 Note Added: 0002884
2004-01-30 00:21 Ingo File Added: Old_Ini.zip
2004-01-30 00:21 Ingo Note Added: 0002890
2004-01-30 00:56 user72 Note Added: 0002891
2004-01-30 00:57 user72 Note Edited: 0002891
2004-01-30 11:13 user72 Note Added: 0002893
2004-01-30 12:42 user72 Note Added: 0002894
2004-02-01 00:16 user72 Note Added: 0002908
2004-02-01 13:54 user72 Status assigned => feedback
2004-02-01 15:26 Ingo Note Added: 0002921
2004-02-02 11:07 user72 Note Added: 0002924
2004-02-02 11:10 user72 Note Edited: 0002924
2004-02-02 11:20 user72 Note Added: 0002925
2004-02-13 14:07 user72 Status feedback => resolved
2004-02-13 14:07 user72 Resolution open => fixed
2004-02-13 14:07 user72 Note Added: 0002935
2004-03-09 02:47 user72 Status resolved => closed