Enum ButtonSet

ボタンセット

alert または prompt に追加できる、事前定義されたローカライズされた 1 つ以上のダイアログ ボタンのセットを表現する列挙型。ユーザーがクリックしたボタンを特定するには、Button を使用します。

列挙型を呼び出すには、その親クラス、名前、プロパティを呼び出します。たとえば、 Base.ButtonSet.OK です。

// 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.'); }

プロパティ

プロパティタイプ説明
OKEnum閉じるのみ可能な情報メッセージを示す 1 つの [OK] ボタン。
OK_CANCELEnum[OK] ボタンと [キャンセル] ボタン: ユーザーがオペレーションを続行または停止できるようにします。
YES_NOEnum[はい] ボタンと [いいえ] ボタン: ユーザーがはい/いいえの質問に回答できるようにします。
YES_NO_CANCELEnum[はい] ボタン、[いいえ] ボタン、[キャンセル] ボタン: ユーザーが「はい/いいえ」の質問に回答したり、オペレーションを停止したりできます。