6. Default Values

6 Default Values

6.1 The Default Value Model

When a new object is created, a set of options is provided by the application. Options which are not explicitly given are taken care of by the parent (the container object).

B=gs:create(button,Win,[{x,0},{label,{text,"press Me"}}]).
    

In the example shown above, the window provides default values for options like location and background color. If an application cannot use the default values provided by GS, new ones can be configured. For example, the following code creates a red button at location y=30.

gs:config(Win,[{default,button,{y,30}},
{default,button,{font,{courier,18}}}]),
B=gs:create(button,Win,[{x,0},{label,{text,"press Me"}}]).
    

The syntax for the default option is {default,Objecttype,{Option,DefaultValue}}, where Objecttype is the name of a