Titanium.UI.OptionDialog

Object of Titanium.UI.
Platform Since
Android 0.8
iPhone 0.8
iPad 0.8

Summary

The Option Dialog is created by Titanium.UI.createOptionDialog and allows you to show a modal dialog of one or more options to the user.

Code Examples

Simple Options Dialog with 2 Options

In this example, we show a simple option dialog.

var dialog = Titanium.UI.createOptionDialog({
    title: 'Hello',
    options: ['Option 1','Option 2'],
    cancel:1
});
dialog.show();

Methods

Name Summary
addEventListener

Adds the specified callback as an event listener for the named event.

fireEvent

Fires a synthesized event to any registered listeners.

removeEventListener

Removes the specified callback as an event listener for the named event.

show

cause the dialog to become visible

Properties

Name Type Summary
androidView Object

A Titanium.UI.View. Allows for arbitrary contents inside a native dialog. Works for any dialog. (Android only.)

cancel Number

an index to indicate which button should be the cancel button. If no button should be the cancel button, use -1. If there is a cancel button, it MUST be the last button for use on iPad.

destructive Number

the destructive button (indicated by a visual clue in the UI)

options Array<Object>

array of button names as strings

selectedIndex Number

set an initially selected option. Only valid when options has been specified. (Android only.)

title String

the title of the dialog

titleid String

the key in the locale file to use for the title property

Events

Name Summary
click

fired when a button in the dialog is clicked