Home / comp / gb.settings / settings 
Settings (gb.settings)
This class manages global configuration files.

Symbols
This class can be used like an object by creating an hidden instance on demand.
This class is creatable.
This class acts like a read / write array.

Static properties  Static methods 
Path    /comp/gb.settings/settings/array   

Methods 
Clear  Read  Reload  Save  Write   

If you use this class statically, then the default project configuration file will be used.

The path of the default configuration file is:

User.Home &/ ".config/gambas" &/ Application.Name & ".conf"

For example, the development environment configuration file is stored in ~/.config/gambas/gambas2.conf

This example would load a windows position from a settings file when a form is opened. If the settings file did not exist then the forms default position would be used. The example also saves the forms position when the form closes. The default settings file for the application is used.

Examples

PUBLIC SUB Form_Open()
  ' Update window position from settings file
  ' If the settings file is not found then
  ' use default position.
  ME.Top = Settings["Window/Top", ME.Top]
  ME.Left = Settings["Window/Left", ME.Left]
  ME.Height = Settings["Window/Height", ME.Height]
  ME.Width = Settings["Window/Width", ME.Width]
END

PUBLIC SUB Form_Close()
  ' Save window settings when application closes
  Settings["Window/Top"] = ME.Top
  Settings["Window/Left"] = ME.Left
  Settings["Window/Height"] = ME.Height
  Settings["Window/Width"] = ME.Width
END

The saved settings file would look something like the following with the settings slots in the Window group.

[Window]
Top=13
Left=18
Height=154
Width=235