CIniFile: Difference between revisions

11 bytes added ,  11 August 2021
m
Sets _not_ Gets!
m (Using "source" tag)
m (Sets _not_ Gets!)
 
(2 intermediate revisions by 2 users not shown)
Line 18: Line 18:


==Visual DataFlex Workspace files==
==Visual DataFlex Workspace files==
Another example are the workspace configuration files used by [[Visual DataFlex]] itself (by default named "Config.ws", showing that they don't have to use the .ini extension - see the artice in "See Also" below), which must exist in the same directory the program is run from (usually the "Programs" subdirectory of the workspace).  Here is an example:
Another example are the workspace configuration files used by [[Visual DataFlex]] itself (by default named "Config.ws", showing that they don't have to use the .ini extension - see the article in "See Also" below), which must exist in the same directory the program is run from (usually the "Programs" subdirectory of the workspace).  Here is an example:


<source lang="ini">
<source lang="ini">
Line 105: Line 105:


// Set the properties to make the information persistent
// Set the properties to make the information persistent
Get psServer  to sServer
Set psServer  to sServer
Get psLogin    to sLogin
Set psLogin    to sLogin
Get psPassword to sPW
Set psPassword to sPW
Get psDriver  to sDrv
Set psDriver  to sDrv
Get psDatabase to sDB
Set psDatabase to sDB
Get pbDoLogin  to bDB
Set pbDoLogin  to bDB
</source>
</source>


Line 117: Line 117:
You could save some code by not retrieving the properties into local variables first, but using the properties as defaults directly:
You could save some code by not retrieving the properties into local variables first, but using the properties as defaults directly:


<source lang="ini">
<source lang="dataflex">
Move (ReadString(hoIni, "Database Login", "Server",  psServer(Self)))  to sServer
Move (ReadString(hoIni, "Database Login", "Server",  psServer(Self)))  to sServer
Move (ReadString(hoIni, "Database Login", "Login",    psLogin(Self)))    to sLogin
Move (ReadString(hoIni, "Database Login", "Login",    psLogin(Self)))    to sLogin
Line 128: Line 128:
Or even dispense with the local variables completely:
Or even dispense with the local variables completely:


<source lang="vdf">
<source lang="dataflex">
Set psServer  to (ReadString(hoIni, "Database Login", "Server",  psServer(Self)))
Set psServer  to (ReadString(hoIni, "Database Login", "Server",  psServer(Self)))
Set psLogin    to (ReadString(hoIni, "Database Login", "Login",    psLogin(Self)))
Set psLogin    to (ReadString(hoIni, "Database Login", "Login",    psLogin(Self)))