alert
または PromptResponse.getSelectedButton()
によって返される、ローカライズされた事前定義のダイアログ ボタンを表す列挙型。ダイアログ内のどのボタンをクリックしたかを示します。これらの値は設定できません。alert
または prompt
にボタンを追加するには、代わりに ButtonSet
を使用します。
列挙型を呼び出すには、親クラス、名前、プロパティを呼び出します。たとえば、
Base.Button.CLOSE
です。
// 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.'); }
プロパティ
プロパティ | 種類 | 説明 |
---|---|---|
CLOSE | Enum | すべてのダイアログのタイトルバーに表示される標準の閉じるボタン。このボタンは明示的にダイアログに追加されていないため、削除できません。 |
OK | Enum | 操作の続行が必要であることを示す「OK」ボタン。 |
CANCEL | Enum | オペレーションを続行しないことを示す [キャンセル] ボタン。 |
YES | Enum | 質問に肯定的な回答が得られたことを示す [はい] ボタン。 |
NO | Enum | 質問に対して否定的な回答があることを示す [いいえ] ボタン。 |