View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001545 | JEDI VCL | 00 JVCL Components | public | 2004-03-29 09:37 | 2004-03-31 06:07 |
Reporter | FlyingAvatar | Assigned To | user72 | ||
Priority | normal | Severity | feature | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | |||||
Target Version | Fixed in Version | ||||
Summary | 0001545: jvAppIniFileStorage ignores DefaultSection on StoredProps | ||||
Description | When using a jvAppIniFileStorage to store the columns property of a ListView, previous versions of JVCL would store this to the INI section "[DefaultSection.ListView1_Columns]". When migrating to version JVCL 3, I've experienced a different behavior, which seems incorrect. Even though DefaultSection is set and the position information is stored under it, stored properties were stored as "[.ListView_Columns]" in the INI without the default section before the name. Also, I assume that preserving the INI file in memory is intentional, but I would prefer that there be a property named something like "CacheINI" to disable this behavior. I currently make changes to the INI separate from jvAppIniFileStorage and these changes are "undone" by jvAppIniFileStorage when the form is closed. | ||||
Tags | No tags attached. | ||||
|
Try changing the following in JvAppIniStorage.pas: function TJvCustomAppIniStorage.ReadValue(const Section, Key: string): string; var ASection:string; begin if IniFile <> nil then begin if Section = '' then ASection := DefaultSection else ASection := Section; if ASection = '' then raise EJVCLAppStorageError.Create(RsEReadValueFailed); Result := IniFile.ReadString(ASection, Key, ''); end else Result := ''; end; procedure TJvCustomAppIniStorage.WriteValue(const Section, Key, Value: string); var ASection:string; begin if IniFile <> nil then begin if Section = '' then ASection := DefaultSection else ASection := Section; if ASection = '' then raise EJVCLAppStorageError.Create(RsEWriteValueFailed); IniFile.WriteString(DefaultSection, Key, Value); if AutoFlush and not IsUpdating then Flush; end; end; > Also, I assume that preserving the INI file in memory is intentional [...] There are solutions to this problem. See the discussion in the newsgroups |
|
Peter, this wouldn't help, since the Section will be '.ListView_Columns'. Technically we could alter the methods to prepend DefaultSection is the Section starts with a '.'. This would remove the possibility of storing to any path starting with a '.' but I doubt that would be a problem. So changing to this (untested) might be better: function TJvCustomAppIniStorage.ReadValue(const Section, Key: string): string; var ASection:string; begin if IniFile <> nil then begin if (Section = '') or (Section[1] = '.') then ASection := DefaultSection else ASection := Section; if (ASection = '') or (ASection[1] = '.') then raise EJVCLAppStorageError.Create(RsEReadValueFailed); Result := IniFile.ReadString(ASection, Key, ''); end else Result := ''; end; procedure TJvCustomAppIniStorage.WriteValue(const Section, Key, Value: string); var ASection:string; begin if IniFile <> nil then begin if (Section = '') or (Section[1] = '.') then ASection := DefaultSection else ASection := Section; if (ASection = '') or (ASection[1] = '.') then raise EJVCLAppStorageError.Create(RsEWriteValueFailed); IniFile.WriteString(DefaultSection, Key, Value); if AutoFlush and not IsUpdating then Flush; end; end; |
|
Shouldn't that be: if (Section = '') or (Section[1] = '.') then ASection := DefaultSection + Section else ASection := Section; Since otherwise you would loose anything after the dot? |
|
Correct. A little too hasty posting the change <g> |
|
Fixed in CVS |
Date Modified | Username | Field | Change |
---|---|---|---|
2004-03-29 09:37 | FlyingAvatar | New Issue | |
2004-03-30 13:24 |
|
Note Added: 0003525 | |
2004-03-30 13:24 |
|
Status | new => assigned |
2004-03-30 13:24 |
|
Assigned To | => user72 |
2004-03-30 13:24 |
|
Status | assigned => feedback |
2004-03-31 02:26 | marcelb | Note Added: 0003535 | |
2004-03-31 03:14 |
|
Note Added: 0003537 | |
2004-03-31 03:21 | marcelb | Note Added: 0003538 | |
2004-03-31 06:07 |
|
Status | feedback => resolved |
2004-03-31 06:07 |
|
Resolution | open => fixed |
2004-03-31 06:07 |
|
Note Added: 0003539 |