
CHAPTER 4: User-Interface Tools Control objects 147
Control event-handling callbacks
The following events are signalled in certain types of controls. To handle the event, define a function with
the corresponding name in the control object. Handler functions take no arguments and have no
expected return values; see “
Defining behavior with event callbacks and listeners” on page 80.
onActivate
Called when the user gives a control the keyboard focus by clicking it or tabbing into
it.
onClick
Called when the user clicks one of the following control types:
Button
IconButton
Checkbox RadioButton
onChange
Called when the user finishes making a change in one of the following control types:
DropDownList
Scrollbar
EditText Slider
ListBox TreeView
X For an EditText control, called only when the change is complete—that is, when
focus moves to another control, or the user types E
NTER. The exact behavior
depends on the creation parameter
enterKeySignalsOnChange; see the
edittext
description.
X For a Slider or Scrollbar, called when the user has finished dragging the position
marker or has clicked the control.
X For a ListBox, DropDownList or TreeView control, called whenever the
selection property changes. This can happen when a script sets the property
directly or removes a selected item from the list, or when the user changes the
selection.
onChanging
Called for each incremental change in one of the following control types:
EditText
Scrollbar
Slider
X For an EditText control, called for each keypress while the control has focus.
X For a Slider or Scrollbar, called for any motion of the position marker.
onCollapse
Called when the user collapses (closes) a node in a TreeView control. The parameter
to this function is the ListItem
node object that was collapsed.
onDeactivate
Called when the user removes keyboard focus from a previously active control by
clicking outside it or tabbing out of it.
onDoubleClick
Called when the user double clicks an item in a ListBox control. The list’s selection
property is set to the clicked item.
onDraw
Called when a container or control is about to be drawn. Allows the script to modify
or control the appearance, using the control’s associated ScriptUIGraphics object
.
Handler takes one argument, a DrawState object
.
Comentarios a estos manuales