
CHAPTER 4: User-Interface Tools Control objects 123
Control objects
UI elements that belong to windows can be containers or controls. Containers share some aspects of
top-level windows, and some aspects of controls, and so are described here with controls.
Control object constructors
Use the add method to create new containers and controls. The add method is available on window and
container (
panel and group) objects. (See also add() for dropdownlist and listbox controls.)
add()
containerObj.(type [, bounds, text, { creation_props> } ]);
type
The control type. See “Control types and creation parameters” on page 124.
bounds
Optional. A bounds specification that describes the size and position of the new
control or container, relative to its parent. See Bounds
object for specification
formats.
If supplied, this value creates a new Bounds
object which is assigned to the new
object’s
bounds property.
text
Optional. String. Initial text to be displayed in the control as the title, label, or
contents, depending on the control type. If supplied, this value is assigned to
the new object’s
text property.
creation_props
Optional. Object. The properties of this object specify creation parameters,
which are specific to each object type. See “
Control types and creation
parameters” on page 124.
Creates and returns a new control or container object and adds it to the children of this window or
container.
Returns the new object, or
null if unable to create the object.
Comentários a estes Manuais