با مجموعهها، منظم بمانید ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
دکمه
یک عدد که نشان دهنده دکمه های گفتگوی از پیش تعیین شده و محلی شده است که توسط یک alert یا Prompt Response.getSelectedButton() بازگردانده می شود تا نشان دهد کاربر روی کدام دکمه در یک گفتگو کلیک کرده است. این مقادیر را نمی توان تنظیم کرد. برای افزودن دکمهها به یک alert یا prompt ، به جای آن از Button Set استفاده کنید.
برای فراخوانی یک enum، کلاس والد، نام و ویژگی آن را فراخوانی می کنید. به عنوان مثال، Base.Button.CLOSE .
// Display a dialog box with a message and "Yes" and "No" buttons.constui=DocumentApp.getUi();constresponse=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
یک دکمه "خیر" که نشان دهنده پاسخ منفی به یک سوال است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003e\u003ccode\u003eButton\u003c/code\u003e is an enum representing localized dialog buttons returned by alerts or prompts, indicating user action.\u003c/p\u003e\n"],["\u003cp\u003eThese predetermined button values (\u003ccode\u003eCLOSE\u003c/code\u003e, \u003ccode\u003eOK\u003c/code\u003e, \u003ccode\u003eCANCEL\u003c/code\u003e, \u003ccode\u003eYES\u003c/code\u003e, \u003ccode\u003eNO\u003c/code\u003e) cannot be set directly but are accessed via \u003ccode\u003eui.Button\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eTo add buttons to alerts or prompts, use \u003ccode\u003eButtonSet\u003c/code\u003e instead of individual \u003ccode\u003eButton\u003c/code\u003e values.\u003c/p\u003e\n"],["\u003cp\u003eThe provided example code demonstrates using \u003ccode\u003eButton\u003c/code\u003e to handle user responses from a dialog.\u003c/p\u003e\n"]]],[],null,["Button\n\nAn enum representing predetermined, localized dialog buttons returned by an [alert](/apps-script/reference/base/ui#alert(String)) or [PromptResponse.getSelectedButton()](/apps-script/reference/base/prompt-response#getSelectedButton()) to indicate\nwhich button in a dialog the user clicked. These values cannot be set; to add buttons to an\n[alert](/apps-script/reference/base/ui#alert(String,ButtonSet)) or [prompt](/apps-script/reference/base/ui#prompt(String,ButtonSet)), use [ButtonSet](/apps-script/reference/base/button-set) instead.\n\nTo call an enum, you call its parent class, name, and property. For example, `\nBase.Button.CLOSE`.\n\n```javascript\n// Display a dialog box with a message and \"Yes\" and \"No\" buttons.\nconst ui = DocumentApp.getUi();\nconst response = ui.alert(\n 'Are you sure you want to continue?',\n ui.ButtonSet.YES_NO,\n);\n\n// Process the user's response.\nif (response === ui.Button.YES) {\n Logger.log('The user clicked \"Yes.\"');\n} else {\n Logger.log('The user clicked \"No\" or the dialog\\'s close button.');\n}\n``` \n\nProperties\n\n| Property | Type | Description |\n|----------|--------|---------------------------------------------------------------------------------------------------------------------------------------------|\n| `CLOSE` | `Enum` | The standard close button displayed in every dialog's title bar. This button is not explicitly added to a dialog, and it cannot be removed. |\n| `OK` | `Enum` | An \"OK\" button, indicating that an operation should proceed. |\n| `CANCEL` | `Enum` | A \"Cancel\" button, indicating that an operation should not proceed. |\n| `YES` | `Enum` | A \"Yes\" button, indicating a positive response to a question. |\n| `NO` | `Enum` | A \"No\" button, indicating a negative response to a question. |"]]