Name: answer

Type: command

Syntax: answer [<iconType>] <prompt> [with <button1> [or <buttons>]] [titled <windowTitle>] [as sheet]

Summary: Displays a <dialog box> with a <message> and up to seven buttons.

Introduced: 1.0

OS: mac,windows,linux,ios,android

Platforms: desktop,web,mobile

Example:
answer "Go ahead?" with "Yes" or "No" or "Maybe"

Example:
answer information filesProcessed && "files were exported."

Example:
answer "Greetings!" with "Log In" or "Cancel" titled "Login"

Example:
answer the currPrompt of me with "OK" or "Cancel" as sheet

Parameters:
iconType (enum): Displayed on the left side of the dialog box. If you do not specify an icon, none is displayed. One of the following types:
- "information"
- "question"
- "error"
- "warning"
prompt (string): The dialog box expands if necessary to fit the contents on desktops, display space on iOS and Android devices can be more restrictive and not provide enough space to expand sufficiently.
button1: 
buttons: Up to seven buttons can be specified, separated by the word "or". The buttons and the dialog box expand if necessary to fit the button names; the total number of characters in the buttons is limited only by the maximum dialog box size and the font size. Display space on iOS and Android devices can be more restrictive and not provide enough space to expand sufficiently. The last button you specify is the default button. Pressing Return or Enter is equivalent to clicking the default button. If you do not specify any button names, the dialog box contains a single OK button.
windowTitle: If specified, appears in the title bar of the dialog box. If you do not specify a windowTitle, the title bar is blank.

It: The name of the button the user chooses is placed in the it <variable>.

Description:
Use the <answer> <command> to get information or a confirmation from the user before continuing. The user must click one of the buttons to dismiss the <dialog box|dialog> box.

The <prompt> can be either formatted text (in the <htmlText> <property|property's> format) or plain text. If the <prompt> contains &lt;p&gt; or a start/end tag pair, the <answer> <command> assumes the text is in the same format as the <htmlText> <property>. Otherwise, the <answer> <command> assumes the text is plain text.

The position and appearance of the dialog box varies between platforms. On Mac OS systems, the dialog box is centered on the screen; on Unix and Windows systems, the dialog box is centered over the active window. On Windows systems, the buttons are shown in reverse order (the first button is on the right side).

On OS X systems, the image specified in the <gRevAppIcon> <variable> appears as the application icon in the <answer> <dialog box> (unless the answer...as sheet form is used). If you specify an <iconType>, the <image> specified in the <gRevSmallAppIcon> <variable> is used instead, along with the special icon specified by the <iconType>.

If the as sheet form is used, the dialog box appears as a sheet on OS X systems. On other systems, the as sheet form has no effect and the dialog box appears normally. Attempting to open a sheet from within another sheet displays the second stack as a <modal dialog box> instead.

>*Cross-platform note:* On <OS X|OS X systems>, there is no image for the question icon. Therefore, the information icon appears instead. In addition, the image specified by the <gRevAppIcon keyword> appears if you don't specify an <iconType>. If you specify an iconType, the image specified by the <gRevSmallAppIcon keyword> appears instead, along with the standard icon specified by the <iconType>. Android and iOS do not support <iconType> and 'as sheet'.

>*Cross-platform note:* The order in which the buttons on the answer dialog appear is platform-dependent. On Windows and Unix systems, the default button is on the left. On Mac OS and OS X systems, to confirm with Apple human interaction guidelines, the default button is always on the right. On iOS and Android, the buttons usually appear from top to bottom.

>*Cross-platform note:* Mobile does not support <iconType> and 'as sheet'.

The ability to provide formatted text for the <prompt> was introduced in version 2.0.

Changes:
The answer...as sheet form was introduced in version 2.0.

References: gRevAppIcon (keyword), image (keyword), gRevProfileReadOnly (keyword), gRevSmallAppIcon (keyword), gRevSmallAppIcon keyword (keyword), gRevAppIcon keyword (keyword), HTMLText (property), breakpoint (command), answer effect (command), answer page setup (command), answer color (command), answer printer (command), ask (command), answer file (command), property (glossary), OS X (glossary), variable (glossary), message (glossary), modal dialog box (glossary), dialog box (glossary), command (glossary)
