alert
または prompt
に追加できる 1 つ以上のダイアログ ボタンのローカライズされた事前定義済みのセットを表す列挙型。ユーザーがクリックしたボタンを特定するには、Button
を使用します。
列挙型を呼び出すには、親クラス、名前、プロパティを呼び出します。たとえば、
Base.ButtonSet.OK
です。
// Display a dialog box with a message and "Yes" and "No" buttons. var ui = DocumentApp.getUi(); var 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.'); }
プロパティ
プロパティ | 種類 | 説明 |
---|---|---|
OK | Enum | 1 つの「OK」ボタン。閉じることのみ可能な情報メッセージがあることを示します。 |
OK_CANCEL | Enum | 「OK」ボタンと「キャンセル」ボタン。ユーザーが操作を続行することも、中止することもできます。 |
YES_NO | Enum | ユーザーが「はい」か「いいえ」で回答できる「はい」ボタンと「いいえ」ボタン。 |
YES_NO_CANCEL | Enum | [はい] ボタン、[いいえ] ボタン、[キャンセル] ボタンの 3 つのボタンで、ユーザーが「はい/いいえ」の質問に答えるか、オペレーションを中止できます。 |