Enum ButtonSet

ButtonSet

列舉代表一或多個預先決定的本地化對話方塊按鈕組合, 新增至 alertprompt。若要判斷使用者點選的是哪個按鈕 使用 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.');
}

屬性

屬性類型說明
OKEnum一個「確定」按鈕,用於表示只能關閉的資訊訊息。
OK_CANCELEnum一個「確定」按鈕和「取消」讓使用者繼續或停止 作業。
YES_NOEnum「是」「否」的按鈕,可讓使用者回答是/否問題。
YES_NO_CANCELEnum「是」則會看到「否」按鈕和「取消」因為使用者可以利用這個按鈕 是/否問題或暫停作業。