# IupConfig

Definition: | include pGUI.e Ihandle config = IupConfig()
Description: | Initialise the configuration file handler. Returns a new database where the variables will be stored.
pwa/p2js: | Not supported. (May be possible to implement using Local Storage.)
Notes | The IupConfigXXX routines are a group of functions to load, store and save application configuration variables. For example, the list of Recent Files, the last position and size of a dialog, options and settings, etc. Each variable has a key name, a value and a group that it belongs to. The file is based on a simple configuration file like ".ini" or ".cfg". Each group can have more than one key, but all keys in the same group must have different names. Group and Key names CANNOT have a period (".") character. The file syntax is such as:
        [Group]
        Key=Value
        Key=Value
Guide | First create a new configuration database using the IupConfig constructor. To destroy it use the IupDestroy function. (Therefore config should really be an Ihandln type.) When the application starts call IupConfigLoad and when the application closes, call IupConfigSave. Call IupConfigRecentInit once to initialize a recent files menu. Call IupConfigRecentUpdate every time a file is open or saved, to keep the recent file menu updated. To retrieve settings use the IupConfigGetVariable* functions and to save settings use the IupConfigSetVariable* functions.
Subsidiary functions |
IupConfigLoad | - | Loads the configuration file.
IupConfigSave | - | Saves the configuration file.
IupConfigRecentInit | - | Initialize a "Recent Files" menu for the application.
IupConfigRecentUpdate | - | Update the recent file menu.
IupConfigSetVariableInt | - | Like IupSetInt, but persistent.
IupConfigSetVariableStr | - | Like IupSetAttribute, but persistent.
IupConfigGetVariableInt | - | Like IupGetInt, but persistent.
IupConfigGetVariableStr | - | Like IupGetAttribute, but persistent.
IupConfigDialogClosed | - | Store the position and size of a dialog
IupConfigDialogShow | - | Show a dialog using the previous position and size
IupConfigCopy(Ihandle ih1, ih2, nullable_string exclude_prefix=NULL); (since 3.23) Copy all the variables from config ih1 to ih2, but excludes groups that start with a given non-NULL prefix.
Attributes: | APP_FILENAME, APP_NAME, APP_CONFIG, APP_PATH, FILENAME, RESIZE as above
Example: |
    Ihandle config = IupConfig();
    IupSetAttribute(config, "APP_NAME", "MyAppName");
    IupConfigLoad(config);
See Also: | IupDestroy, IupSetAttribute, IupGetAttribute