تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
Button
فهرس يمثّل أزرار مربّعات الحوار المترجَمة والمحدّدة مسبقًا التي يعرضها alert أو PromptResponse.getSelectedButton() للإشارة إلى
الزر الذي نقر عليه المستخدم في مربّع الحوار لا يمكن ضبط هذه القيم. لإضافة أزرار إلى
alert أو prompt، استخدِم ButtonSet بدلاً من ذلك.
لاستدعاء قائمة أرقام صحيحة، عليك استدعاء الصف الرئيسي والاسم والخاصية. مثلاً:
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
زر "حسنًا" يشير إلى أنّه يجب مواصلة إجراء عملية
CANCEL
Enum
زر "إلغاء" يشير إلى أنّه يجب عدم مواصلة تنفيذ العملية
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\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,["# Enum Button\n\nButton\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\n### Properties\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. |"]]