3. Options

3 Options

3.1 The Option Concept

Each object has a set of options. The options are key-value tuples and the key is an atom. Depending on the option, the value can be any Erlang term. Typical options are: x, y, width, height, text, and color. A list of options should be supplied when an object is created . It is also possible to reconfigure an object with the function gs:config/2. The following example shows one way to create a red button with the text "Press Me" on it:

Butt = gs:create(button,Win, [{x,10},{y,10}]),
gs:config(Butt, [{width,50},{height,50},{bg,red}]),
gs:config(Butt, [{label, {text,"Press Me"}},{y,20}]),
    

The evaluation order of options is not defined. This implies that the grouping of options shown in the following example is not recommended:

Rect = gs:create(rectangle,Can, [{coords,[{10,10},{20,20}]},