class_acceptdialog.rst 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the AcceptDialog.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_AcceptDialog:
  6. AcceptDialog
  7. ============
  8. **Inherits:** :ref:`WindowDialog<class_WindowDialog>` **<** :ref:`Popup<class_Popup>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`ConfirmationDialog<class_ConfirmationDialog>`
  10. **Category:** Core
  11. Brief Description
  12. -----------------
  13. Base dialog for user notification.
  14. Properties
  15. ----------
  16. +-----------------------------+-------------------------------------------------------------------------+
  17. | :ref:`bool<class_bool>` | :ref:`dialog_hide_on_ok<class_AcceptDialog_property_dialog_hide_on_ok>` |
  18. +-----------------------------+-------------------------------------------------------------------------+
  19. | :ref:`String<class_String>` | :ref:`dialog_text<class_AcceptDialog_property_dialog_text>` |
  20. +-----------------------------+-------------------------------------------------------------------------+
  21. Methods
  22. -------
  23. +-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`Button<class_Button>` | :ref:`add_button<class_AcceptDialog_method_add_button>` **(** :ref:`String<class_String>` text, :ref:`bool<class_bool>` right=false, :ref:`String<class_String>` action="" **)** |
  25. +-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`Button<class_Button>` | :ref:`add_cancel<class_AcceptDialog_method_add_cancel>` **(** :ref:`String<class_String>` name **)** |
  27. +-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`Label<class_Label>` | :ref:`get_label<class_AcceptDialog_method_get_label>` **(** **)** |
  29. +-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`Button<class_Button>` | :ref:`get_ok<class_AcceptDialog_method_get_ok>` **(** **)** |
  31. +-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`register_text_enter<class_AcceptDialog_method_register_text_enter>` **(** :ref:`Node<class_Node>` line_edit **)** |
  33. +-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. Signals
  35. -------
  36. .. _class_AcceptDialog_signal_confirmed:
  37. - **confirmed** **(** **)**
  38. Emitted when the dialog is accepted, i.e. the OK button is pressed.
  39. ----
  40. .. _class_AcceptDialog_signal_custom_action:
  41. - **custom_action** **(** :ref:`String<class_String>` action **)**
  42. Emitted when a custom button is pressed. See :ref:`add_button<class_AcceptDialog_method_add_button>`.
  43. Description
  44. -----------
  45. This dialog is useful for small notifications to the user about an event. It can only be accepted or closed, with the same result.
  46. Property Descriptions
  47. ---------------------
  48. .. _class_AcceptDialog_property_dialog_hide_on_ok:
  49. - :ref:`bool<class_bool>` **dialog_hide_on_ok**
  50. +----------+-----------------------+
  51. | *Setter* | set_hide_on_ok(value) |
  52. +----------+-----------------------+
  53. | *Getter* | get_hide_on_ok() |
  54. +----------+-----------------------+
  55. If ``true``, the dialog is hidden when the OK button is pressed. You can set it to ``false`` if you want to do e.g. input validation when receiving the :ref:`confirmed<class_AcceptDialog_signal_confirmed>` signal, and handle hiding the dialog in your own logic. Default value: ``true``.
  56. Note: Some nodes derived from this class can have a different default value, and potentially their own built-in logic overriding this setting. For example :ref:`FileDialog<class_FileDialog>` defaults to ``false``, and has its own input validation code that is called when you press OK, which eventually hides the dialog if the input is valid. As such this property can't be used in :ref:`FileDialog<class_FileDialog>` to disable hiding the dialog when pressing OK.
  57. ----
  58. .. _class_AcceptDialog_property_dialog_text:
  59. - :ref:`String<class_String>` **dialog_text**
  60. +----------+-----------------+
  61. | *Setter* | set_text(value) |
  62. +----------+-----------------+
  63. | *Getter* | get_text() |
  64. +----------+-----------------+
  65. The text displayed by this dialog.
  66. Method Descriptions
  67. -------------------
  68. .. _class_AcceptDialog_method_add_button:
  69. - :ref:`Button<class_Button>` **add_button** **(** :ref:`String<class_String>` text, :ref:`bool<class_bool>` right=false, :ref:`String<class_String>` action="" **)**
  70. Adds a button with label *text* and a custom *action* to the dialog and returns the created button. *action* will be passed to the :ref:`custom_action<class_AcceptDialog_signal_custom_action>` signal when pressed.
  71. If ``true``, *right* will place the button to the right of any sibling buttons. Default value: ``false``.
  72. ----
  73. .. _class_AcceptDialog_method_add_cancel:
  74. - :ref:`Button<class_Button>` **add_cancel** **(** :ref:`String<class_String>` name **)**
  75. Adds a button with label *name* and a cancel action to the dialog and returns the created button.
  76. ----
  77. .. _class_AcceptDialog_method_get_label:
  78. - :ref:`Label<class_Label>` **get_label** **(** **)**
  79. Returns the label used for built-in text.
  80. ----
  81. .. _class_AcceptDialog_method_get_ok:
  82. - :ref:`Button<class_Button>` **get_ok** **(** **)**
  83. Returns the OK Button.
  84. ----
  85. .. _class_AcceptDialog_method_register_text_enter:
  86. - void **register_text_enter** **(** :ref:`Node<class_Node>` line_edit **)**
  87. Registers a :ref:`LineEdit<class_LineEdit>` in the dialog. When the enter key is pressed, the dialog will be accepted.