* Fixed bug (actually feature) in 23645

git-svn-id: trunk@26875 -
This commit is contained in:
michael 2014-02-25 09:19:32 +00:00
parent 921c785cc7
commit 48eacbae41

View File

@ -62,13 +62,16 @@ type
TReadStrEvent = function(const ASection, Item, Default: string): string of object;
TWriteStrEvent = procedure(const ASection, Item, Value: string) of object;
TEraseSectEvent = procedure(const ASection: string) of object;
TPropStorageOption = (psoAlwaysStoreStringsCount);
TPropStorageOptions = set of TPropStorageOption;
TPropsStorage = class(TObject)
private
FObject: TObject;
FOwner: TComponent;
FPrefix: string;
FSection: string;
FOptions : TPropStorageOptions;
FOnReadString: TReadStrEvent;
FOnWriteString: TWriteStrEvent;
FOnEraseSection: TEraseSectEvent;
@ -113,6 +116,7 @@ type
procedure LoadProperties(PropList: TStrings);
procedure LoadObjectsProps(AComponent: TComponent; StoredList: TStrings);
procedure StoreObjectsProps(AComponent: TComponent; StoredList: TStrings);
Property Options : TPropStorageOptions Read FOptions Write FOptions;
property AObject: TObject read FObject write FObject;
property Prefix: string read FPrefix write FPrefix;
property Section: string read FSection write FSection;
@ -465,11 +469,13 @@ begin
List := TObject(GetObjectProp(Self.FObject, PropInfo));
SectName := Format('%s.%s', [Section, GetItemName(PropInfo^.Name)]);
EraseSection(SectName);
if (List is TStrings) and (TStrings(List).Count > 0) then begin
if (List is TStrings)
and ((TStrings(List).Count > 0) or (psoAlwaysStoreStringsCount in Options)) then
begin
WriteString(SectName, sCount, IntToStr(TStrings(List).Count));
for I := 0 to TStrings(List).Count - 1 do
WriteString(SectName, Format(sItem, [I]), TStrings(List)[I]);
end;
end;
end;
function TPropsStorage.StoreComponentProperty(PropInfo: PPropInfo): string;