提供意見
Enum ButtonSet
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
ButtonSet
列舉代表預先決定的本地化組合,包含可新增至 alert
或 prompt
的對話方塊按鈕組合。如要判斷使用者點選了哪個按鈕,請使用 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
一個「確定」按鈕,表示只能關閉的資訊訊息。
OK_CANCEL
Enum
「OK」按鈕和「取消」按鈕,可讓使用者繼續執行或停止作業。
YES_NO
Enum
「是」按鈕和「否」按鈕,可讓使用者回答是非題。
YES_NO_CANCEL
Enum
「是」按鈕、「否」按鈕和「取消」按鈕,可讓使用者回答是非題或停止作業。
提供意見
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權 ,程式碼範例則為阿帕契 2.0 授權 。詳情請參閱《Google Developers 網站政策 》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2023-12-01 (世界標準時間)。
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"缺少我需要的資訊"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"過於複雜/步驟過多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"過時"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻譯問題"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/程式碼問題"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"容易理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"確實解決了我的問題"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]
想進一步說明嗎?