class_acceptdialog.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/AcceptDialog.xml.
  6. .. _class_AcceptDialog:
  7. AcceptDialog
  8. ============
  9. **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>`
  10. **Inherited By:** :ref:`ConfirmationDialog<class_ConfirmationDialog>`
  11. Base dialog for user notification.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. This dialog is useful for small notifications to the user about an event. It can only be accepted or closed, with the same result.
  16. .. rst-class:: classref-reftable-group
  17. Properties
  18. ----------
  19. .. table::
  20. :widths: auto
  21. +-----------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`dialog_autowrap<class_AcceptDialog_property_dialog_autowrap>` | ``false`` |
  23. +-----------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`dialog_hide_on_ok<class_AcceptDialog_property_dialog_hide_on_ok>` | ``true`` |
  25. +-----------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
  26. | :ref:`String<class_String>` | :ref:`dialog_text<class_AcceptDialog_property_dialog_text>` | ``""`` |
  27. +-----------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
  28. | :ref:`String<class_String>` | window_title | ``"Alert!"`` (overrides :ref:`WindowDialog<class_WindowDialog_property_window_title>`) |
  29. +-----------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
  30. .. rst-class:: classref-reftable-group
  31. Methods
  32. -------
  33. .. table::
  34. :widths: auto
  35. +-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :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="" **)** |
  37. +-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`Button<class_Button>` | :ref:`add_cancel<class_AcceptDialog_method_add_cancel>` **(** :ref:`String<class_String>` name **)** |
  39. +-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`Label<class_Label>` | :ref:`get_label<class_AcceptDialog_method_get_label>` **(** **)** |
  41. +-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`Button<class_Button>` | :ref:`get_ok<class_AcceptDialog_method_get_ok>` **(** **)** |
  43. +-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`register_text_enter<class_AcceptDialog_method_register_text_enter>` **(** :ref:`Node<class_Node>` line_edit **)** |
  45. +-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`remove_button<class_AcceptDialog_method_remove_button>` **(** :ref:`Control<class_Control>` button **)** |
  47. +-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. .. rst-class:: classref-section-separator
  49. ----
  50. .. rst-class:: classref-descriptions-group
  51. Signals
  52. -------
  53. .. _class_AcceptDialog_signal_confirmed:
  54. .. rst-class:: classref-signal
  55. **confirmed** **(** **)**
  56. Emitted when the dialog is accepted, i.e. the OK button is pressed.
  57. .. rst-class:: classref-item-separator
  58. ----
  59. .. _class_AcceptDialog_signal_custom_action:
  60. .. rst-class:: classref-signal
  61. **custom_action** **(** :ref:`String<class_String>` action **)**
  62. Emitted when a custom button is pressed. See :ref:`add_button<class_AcceptDialog_method_add_button>`.
  63. .. rst-class:: classref-section-separator
  64. ----
  65. .. rst-class:: classref-descriptions-group
  66. Property Descriptions
  67. ---------------------
  68. .. _class_AcceptDialog_property_dialog_autowrap:
  69. .. rst-class:: classref-property
  70. :ref:`bool<class_bool>` **dialog_autowrap** = ``false``
  71. .. rst-class:: classref-property-setget
  72. - void **set_autowrap** **(** :ref:`bool<class_bool>` value **)**
  73. - :ref:`bool<class_bool>` **has_autowrap** **(** **)**
  74. Sets autowrapping for the text in the dialog.
  75. .. rst-class:: classref-item-separator
  76. ----
  77. .. _class_AcceptDialog_property_dialog_hide_on_ok:
  78. .. rst-class:: classref-property
  79. :ref:`bool<class_bool>` **dialog_hide_on_ok** = ``true``
  80. .. rst-class:: classref-property-setget
  81. - void **set_hide_on_ok** **(** :ref:`bool<class_bool>` value **)**
  82. - :ref:`bool<class_bool>` **get_hide_on_ok** **(** **)**
  83. 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.
  84. \ **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.
  85. .. rst-class:: classref-item-separator
  86. ----
  87. .. _class_AcceptDialog_property_dialog_text:
  88. .. rst-class:: classref-property
  89. :ref:`String<class_String>` **dialog_text** = ``""``
  90. .. rst-class:: classref-property-setget
  91. - void **set_text** **(** :ref:`String<class_String>` value **)**
  92. - :ref:`String<class_String>` **get_text** **(** **)**
  93. The text displayed by the dialog.
  94. .. rst-class:: classref-section-separator
  95. ----
  96. .. rst-class:: classref-descriptions-group
  97. Method Descriptions
  98. -------------------
  99. .. _class_AcceptDialog_method_add_button:
  100. .. rst-class:: classref-method
  101. :ref:`Button<class_Button>` **add_button** **(** :ref:`String<class_String>` text, :ref:`bool<class_bool>` right=false, :ref:`String<class_String>` action="" **)**
  102. 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.
  103. If ``true``, ``right`` will place the button to the right of any sibling buttons.
  104. You can use :ref:`remove_button<class_AcceptDialog_method_remove_button>` method to remove a button created with this method from the dialog.
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _class_AcceptDialog_method_add_cancel:
  108. .. rst-class:: classref-method
  109. :ref:`Button<class_Button>` **add_cancel** **(** :ref:`String<class_String>` name **)**
  110. Adds a button with label ``name`` and a cancel action to the dialog and returns the created button.
  111. You can use :ref:`remove_button<class_AcceptDialog_method_remove_button>` method to remove a button created with this method from the dialog.
  112. .. rst-class:: classref-item-separator
  113. ----
  114. .. _class_AcceptDialog_method_get_label:
  115. .. rst-class:: classref-method
  116. :ref:`Label<class_Label>` **get_label** **(** **)**
  117. Returns the label used for built-in text.
  118. \ **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their :ref:`CanvasItem.visible<class_CanvasItem_property_visible>` property.
  119. .. rst-class:: classref-item-separator
  120. ----
  121. .. _class_AcceptDialog_method_get_ok:
  122. .. rst-class:: classref-method
  123. :ref:`Button<class_Button>` **get_ok** **(** **)**
  124. Returns the OK :ref:`Button<class_Button>` instance.
  125. \ **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their :ref:`CanvasItem.visible<class_CanvasItem_property_visible>` property.
  126. .. rst-class:: classref-item-separator
  127. ----
  128. .. _class_AcceptDialog_method_register_text_enter:
  129. .. rst-class:: classref-method
  130. void **register_text_enter** **(** :ref:`Node<class_Node>` line_edit **)**
  131. Registers a :ref:`LineEdit<class_LineEdit>` in the dialog. When the enter key is pressed, the dialog will be accepted.
  132. .. rst-class:: classref-item-separator
  133. ----
  134. .. _class_AcceptDialog_method_remove_button:
  135. .. rst-class:: classref-method
  136. void **remove_button** **(** :ref:`Control<class_Control>` button **)**
  137. Removes the ``button`` from the dialog. Does NOT free the ``button``. The ``button`` must be a :ref:`Button<class_Button>` added with :ref:`add_button<class_AcceptDialog_method_add_button>` or :ref:`add_cancel<class_AcceptDialog_method_add_cancel>` method. After removal, pressing the ``button`` will no longer emit this dialog's :ref:`custom_action<class_AcceptDialog_signal_custom_action>` signal or cancel this dialog.
  138. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  139. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  140. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  141. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`