Container
The Container widget acts as a container of widgets. Users can insert any kind of widgets into a container, which then becomes their parent.
In a Custom Model script, this.widget is the Custom Widget's Container. Add a newly created Canvas or MouseArea to this Container for it to appear and receive events. A Custom Model can also contain Widgets placed in its editor. Use custom Properties and Methods to package their interactions.
Inherits from Widget.
Inherited properties: height, opacity, rotation, width, x, y.
Methods
add(widget)
Inserts a widget into the container. This also changes the position and size of the widget to fill the container.
Parameters
| Name | Type | Description |
|---|---|---|
widget | Widget | The widget to insert. |
Returns: Boolean — true if the insertion succeeded.
Example
js
var mouseArea = new MouseArea();
var canvas = new Canvas();
this.widget.add(mouseArea);
this.widget.add(canvas);