Definition: |
include pGUI.e
string res = IupConfigGetVariableStr(Ihandle config, string group, string key, nullable_string def=NULL) -- or -- string res = IupConfigGetVariableStrId(Ihandle config, string group, string key, integer id, nullable_string def=NULL) |
Description: |
This function is similar to the IupGetAttribute function, but persistent and optionally with a default.
config: Identifier of the configuration database (see IupConfig) group: group name of the variable key: key name of the variable id: used when the variable has a sequential number def: default value of the variable The group and key names should be arbitrarily selected by the programmer to be meaningful and unique across the application, just as you would if you were writing out a .ini file by hand. For example "MainWindow", "Font", "Arial" should result in a config file that contains, amongst other things, "[MainWindow]\nFont=Arial\n". Internally variables are stored as attributes using a " Returns: the variable value or "" if the variable is not set or does not exist. |
Notes: | The IupConfigGetVariableStr[Id]Def C functions can be replaced with the pGUI functions without the trailing "Def". |
Example: |
Ihandle config = IupConfig(); IupSetAttribute(config, "APP_NAME", "MyAppName"); IupConfigLoad(config); string font = IupConfigGetVariableStr(config, "MainWindow", "Font"); |
See Also: | IupConfig, IupSetAttribute, IupConfigLoad, IupGetAttribute |