Sidebar

Home



Expressions V4


Tutorials

How-To

Reference

  Lexical basics
  Type system
  Variables and assignment
  Operators
  Expression rules
  Control flow
  Functions
  Built-in functions
   None and NaN
   Arithmetic
   Algebra
   Logarithmic and Exponential
   Trigonometric
   Rounding and Centering
   Strings
   Output, Formatting, Clipboard, and Errors
   Dialog Functions
   Platform and Paths
  Methods and properties
  Built-in methods
   Common Value Methods
   Number Methods
   String Basic Methods
   String Slice Methods
   String Parsing Methods
   String Formatting Methods
   String Regex Methods
   String Trim and Case Methods
  Objects
  Built-in objects
   Global objects
    settings
    controller
    session
    python
   Collections
    array
    map
    bytes
   File Format I/O
    image_data
    image_stream
   Utils
    crypto
    timer
   Comm
    serial
   Dialogs
    file_open
    file_save
    msg_ok
    msg_ok_cancel
    msg_yes_no
    msg_password
   GUI objects
    window
    panel
    group
    splitpanel
    label
    textbutton
    drawablebutton
    togglebutton
    togglegroup
    textinput
    textedit
    numinput
    slider
    combobox
    listbox
    progressbar
    led
    separator
    menu
    image
    snake
  Classes and user-defined objects
  Include system
  Error model
  Execution model and sessions
  Host integration
  Limits and performance
  Formal reference
  Glossary

Cookbook

exprv4:reference:objects:settings

settings

`settings` is a built-in global object for reading and writing host application settings.

It is used directly by name. Do not call `settings()`.

Constructor

`settings` is a predefined global object. It is not created with a constructor.

Item Description
Syntax `settings`
Arguments not applicable
Returns settings object
print(settings.exists('displayX'));

Properties

Known settings can be read as properties.

Property names are host setting names. If the setting does not exist, property access raises an error.

x = settings.displayX;

Use `exists(name)` before reading optional settings or settings that may depend on host version.

if (settings.exists('displayX'))
{
    x = settings.displayX;
}

Common Object Methods

to_string()

Returns a display string for the object.

Item Description
Syntax `value.to_string()`
Arguments none
Returns string

Example:

text = value.to_string();

`clone()` is not supported for `settings`.

Methods

exists(name)

Returns `true` if a setting with `name` exists.

Item Description
Syntax `settings.exists(name)`
Arguments `name`: setting name
Returns boolean
if (settings.exists('displayX'))
{
    print('setting exists');
}

get(name)

Returns the setting value.

If the setting does not exist, an error is raised.

Item Description
Syntax `settings.get(name)`
Arguments `name`: setting name
Returns setting value
x = settings.get('displayX');

set(name, value)

Sets a setting value and returns an OK result.

If the setting does not exist or the value is invalid for that setting, an error is raised.

Item Description
Syntax `settings.set(name, value)`
Arguments `name`: setting name; `value`: new setting value
Returns OK result
settings.set('displayX', 100);

Assignment

`settings` is a protected built-in global name. The name itself cannot be overwritten.

settings = 1;     // error

Use `set(name, value)` to change an application setting.

Example

if (settings.exists('displayX'))
{
    old_x = settings.get('displayX');
    print('old displayX: ', old_x);
 
    settings.set('displayX', old_x);
}

Previous: Global objects

Next: controller

exprv4/reference/objects/settings.txt · Last modified: by 127.0.0.1

Page Tools