Alter record or window members at runtime
I am writing a class to access ini files, because SilkTest's ini file functions have some problematic limitations:
IniFileGetValue() returns an empty string in all of these cases:
1. File not found
2. Section not found
3. Setting (Name) not found
4. Setting value is empty string (Setting=)
IniFileGetValue() requires a section to be specified; some ini files don't have section headers
Can't get a list of the headers, or of the settings, so they have to be known ahead of time
Lack of object-oriented design (I want to access settings like this: MyIniFile.MySection.MySetting.Value
It is the the last part that I am having trouble with. I have seen Richard Weth's Dictionary class (http://www.qadownloads.com/cgi-bin/d...ump.cgi?ID=132), but it suffers from the same problem I am having; the need to call a function to search a list, rather than being able to access members directly.
For example, if I knew the exact structure of the ini file ahead of time, then I could create a record for each section of the ini file, whose fields would be the setting names. I could store these records in a record, with one field for each section. Obviously, I want something dynamic.
I can currently access the settings like this:
But it's unfortunate to have to use method calls that search through lists, rather than just accessing the section as a member of the ini file, and the setting as a member of the section.