Alternative Widget Constructor

Create a widget by specifying the top-left corner position, width & height

This is a simple example for an alternative Widget constructor. Instead of specifying the top, bottom, left and right positions of the widget the alternative constructor takes the top, left, width and height of the button as arguments.

newWidget – There are 10 input arguments:
– window = a Window object
– type = the widget type (Widget.BUTTON, Widget.LABEL, etc. See the JS API manual for all the Widget types)
– left = the left position of the widget
– top = the top position of the widget
– width = the width of the widget
– height = the height of the widget
– text = the text to display on the widget
– background = the background colour of the widget
– foreground = the foreground colour of the widget
– arr = an array of text to use when creating Widget.COMBOBOX widgets. Each element in the array will be added as a WidgetItem to the Combobox widget. For any other widget this argument can be passed as null.

The function returns the Widget object.