Instantiation

The instantiation of a Style is done with the 'new' constructor:

var dFrameStyle = new DFrameStyle()

In this case the instantiation is done without parameter and all properties of the objects have a default value, some with a null value (colors for example), others with a value that allow the object to be visible (Bar's borders for instance have a width of 1 and a black color).

It is also possible to instantiate a Style with another one as model. In this case properties of the original Style are 'copied' to the new one:

var dFrameStyle = new DFrameStyle()

dFrameStyle.setBackgroundColor('green')

var specificDFrameStyle = new DFrameStyle(dFrameStyle)

 

When you work with Styles you must also remember 2 important features:

§         Each time an object is instantiated with a Style a copy of the Style is created for the new object:

The following code:

var dFrame = new DFrame(position, title, dFrameStyle)

var x = dFrame.getStyle().getTitleBarStyle()

x.setHeight(0)

will

§         set the height of the Style of dFrame

§         will not modify dFrameStyle as a "personal" copy of dFrameStyle has been created for dFrame and the getStyle method returns this one.

All objects have a Style after they have been created. It can be the Style set while instantiation of the object, the default Style of the parent or, at last and should not happen, a Style that dFrameAPI creates from scratch.