Enum Button

ボタン

alert または PromptResponse.getSelectedButton() によって返される、事前定義されたローカライズされたダイアログ ボタンを表す列挙型。ユーザーがダイアログ内のどのボタンをクリックしたかを示します。これらの値は設定できません。alert または prompt にボタンを追加するには、代わりに ButtonSet を使用します。

列挙型を呼び出すには、その親クラス、名前、プロパティを呼び出します。たとえば、 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.'); }

プロパティ

プロパティタイプ説明
CLOSEEnumすべてのダイアログのタイトルバーに表示される標準の閉じるボタン。このボタンはダイアログに明示的に追加されず、削除できません。
OKEnumオペレーションを続行することを示す [OK] ボタン。
CANCELEnumオペレーションを続行しないことを示す [キャンセル] ボタン。
YESEnum質問に対する肯定的な回答を示す [はい] ボタン。
NOEnum質問に対する否定的な回答を示す [いいえ] ボタン。