Summary
A button contains text and an optional image and provides registration for a click handler. Button object text can be controlled like a TextField with setText(), getText(), setFont(), and setTextColor().
void setImage(image[,state])
void onClick(handler)
Example
root = new View("ipad-portrait");
button = root.createButton(400,200);
button.setText("Click Me");
function click(sender) {
document.writeln(sender.getText() + " clicked");
}
button.onClick(click);
document.wait();
setImage
Sets the image on the button for a given state.
void setImage(image[,state])
Parameters
image - image object created using Image() constructor
state - optional string, one of "highlighted", "selected", "disabled"
Return Value
none
Notes
If no state is specified, the image is always used for the button regardless of state.
onClick
Register event handler for button click events. onClick is also used to register event handlers for checkbox and slider events.
void onClick(handler)
Parameters
handler - function to call when the button is clicked
Return Value
none
Notes
Click handler has the format
function <handler>(sender)
Where sender is the button that was tapped by the user.