KUIML
Blue Cat's User Interface Programming Language
VARIABLE

Description

This element ca be used to define custom values to be reused later in the attributes of other elements, in order to avoid repeating several times the same value. It makes it easier to change the value once rather than everywhere in the code.

Note: to avoid conflicts with Predefined Variables, variables starting and ending with '_' are reserved to the KUIML engine.

Attributes

Name Value Type Default Value Description Comment V. Exp.

id

element id

empty

id of the variable.

This is the name you will use everywhere in the skin and it will be replaced by the value attribute.

1.3

No

value

string

empty

value of the variable.

This is the value that will replace the '$id$' string everywhere in the skin.

1.3

No

formula

Math Formula

empty

The formula can reference other static variables that have been defined previously. The result of the formula is stored in the variable at the declaration of the variable and is not updated later, even if other variables it depends on are changed.

This attributes overrides the "value" attribute when set.

1.7

No

script

script returning a string

empty

Script that returns a string that defines the new value of the variable. It can use functions that have been defined in the build_time_script_include file (but not other runtime function defined in runtime scripts). It can also refer to build time variables that have been defined before.

This attributes overrides the "value" and "formula" attribute when set. It is currently experimental.

2.6

No

override

boolean

false

override previously defined value.

Setting this to true removes the warning that is normally thrown when a variable is defined twice.

1.7

No

Syntax

First declare a variable as shown here:

<VARIABLE id="my_variable" value="hello world!" />

Once this variable has been declared, writing the following

<TEXT value="$my_variable$"/>

is equivalent to writing:

<TEXT value="hello world!"/>

The same example, with script syntax (note that all special characters in script have to be escaped):

<VARIABLE id="my_variable" script="return &quot;hello world!&quot;" />