If the LoadFromRegistry does not find the registry keys, it uses default values, and those values might override values established at design time (especially column visibility). It would be useful to have a "RegistryEntriesFound" function that could test the registry to determine whether a SaveToRegistry had already been performed, so that LoadFromRegistry could be skipped or aborted if previously saved information is not present.
For my application, I frequently have columns that are invisible, and if I perform a LoadFromRegistry prior to SaveToRegistry, I lose the invisibility status of those columns.
Using the "SectionExists" method of the tCustomIniFile might be an appropriate way to perform this test.
LoadFromRegistry suggestion
Started by Jordan, Jul 14 2009 05:34 PM
3 replies to this topic
#1
Posted 14 July 2009 - 05:34 PM
#2
Posted 14 July 2009 - 05:54 PM
I tried this test code for the function I suggested and it worked fine for what I needed:
CODE
function tNXCustomGridControl.SavedDataExists(const KeyName: WideString;
ID: string): boolean;
var
IniFile: TRegistryIniFile;
begin
try
IniFile := TRegistryIniFile.Create(KeyName);
Result := IniFile.SectionExists('Common' + ID);
finally
FreeAndNil(IniFile);
end;
end;
ID: string): boolean;
var
IniFile: TRegistryIniFile;
begin
try
IniFile := TRegistryIniFile.Create(KeyName);
Result := IniFile.SectionExists('Common' + ID);
finally
FreeAndNil(IniFile);
end;
end;
#3
Posted 14 July 2009 - 10:22 PM
Hello Jordan,
Can you please use this function if not a problem, inside your unit. Thank you.
Best regards
Can you please use this function if not a problem, inside your unit. Thank you.
Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#4
Posted 15 July 2009 - 03:20 AM
QUOTE (Boki (Berg) @ Jul 14 2009, 05:22 PM) <{POST_SNAPBACK}>
Hello Jordan,
Can you please use this function if not a problem, inside your unit. Thank you.
Best regards
Can you please use this function if not a problem, inside your unit. Thank you.
Best regards
No problem...it's working fine for me as described.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











