
CHAPTER 4: User-Interface Tools Types of controls 68
User-interface controls
These are types of Control objects that are contained in windows, panels, and groups, and that provide
specific kinds of display and user interaction. Control instances are created by passing the corresponding
type keyword to the add() method of a Window or container; see “Control types and creation parameters”
on page 124.
These examples do not set bounds explicitly on creation, because it is often more useful to set a preferred
size, then allow the layout manager to set the bounds; see “
Automatic layout” on page 86.
Group
Used to visually organize related controls. Unlike Panels, Groups have no title or
visible border. You can use them to create hierarchies of controls, and for fine control
over layout attributes of certain groups of controls within a larger panel. For examples,
see “
Creating more complex arrangements” on page 92.
TabbedPanel
A panel that contains only Tab objects as its immediate children. It has a selection
property that contains the currently active
Tab child. When the value of the selection
property changes, either by a user selecting a different tab, or by a script setting the
property, the
TabbedPanel receives an onChange notification.
The
title property provides an optional label; the titleLayout property places the
label within the panel.
Tab
A general container whose parent is a TabbedPanel, with a selectable tab showing a
localizable
text value. Its size and position are determined by the parent.
Button
Typically used to initiate some action from a window when a user clicks the button;
for example, accepting a dialog’s current settings, canceling a dialog, bringing up a
new dialog, and so on.
X Set the text property to assign a label to identify a Button’s function.
X The onClick callback method provides behavior.
var dlg = new Window(‘dialog’, ‘Alert Box Builder’);
dlg.btnPnl = dlg.add(‘panel’, undefined, ‘Build it’);
dlg.btnPnl.testBtn = dlg.btnPnl.add(‘button’, undefined, ‘Test’);
dlg.btnPnl.buildBtn = dlg.btnPnl.add(‘button’, undefined, ‘Build’,
{name:’ok’});
dlg.btnPnl.cancelBtn = dlg.btnPnl.add(‘button’, undefined, ‘Cancel’,
{name:’cancel’});
dlg.show();
IconButton
A button that displays an icon, with or without a text label. Like a text button, typically
initiates an action in response to a click.
X The image property identifies the icon image; see “Displaying images” on
page 72.
X The title or text property provides an optional label; the titleLayout property
places the label with respect to the image.
X The onClick callback method provides behavior.
Comentários a estes Manuais