Stay organized with collections Save and categorize content based on your preferences.
ButtonAn enum representing predetermined, localized dialog buttons returned by an alert
or PromptResponse.getSelectedButton()
to indicate which button in a dialog the user clicked. These values cannot be set; to add buttons to an alert
or prompt
, use ButtonSet
instead.
To call an enum, you call its parent class, name, and property. For example, Base.Button.CLOSE
.
// Display a dialog box with a message and "Yes" and "No" buttons. const ui = DocumentApp.getUi(); const response = ui.alert( 'Are you sure you want to continue?', ui.ButtonSet.YES_NO, ); // Process the user's response. if (response === ui.Button.YES) { Logger.log('The user clicked "Yes."'); } else { Logger.log('The user clicked "No" or the dialog\'s close button.'); }Properties Property Type Description
CLOSE
Enum
The standard close button displayed in every dialog's title bar. This button is not explicitly added to a dialog, and it cannot be removed. OK
Enum
An "OK" button, indicating that an operation should proceed. CANCEL
Enum
A "Cancel" button, indicating that an operation should not proceed. YES
Enum
A "Yes" button, indicating a positive response to a question. NO
Enum
A "No" button, indicating a negative response to a question.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-02 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-02 UTC."],[[["`Button` is an enum representing localized dialog buttons returned by alerts or prompts, indicating user action."],["These predetermined button values (`CLOSE`, `OK`, `CANCEL`, `YES`, `NO`) cannot be set directly but are accessed via `ui.Button`."],["To add buttons to alerts or prompts, use `ButtonSet` instead of individual `Button` values."],["The provided example code demonstrates using `Button` to handle user responses from a dialog."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4