class_acceptdialog.rst 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the AcceptDialog.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_AcceptDialog:
  5. AcceptDialog
  6. ============
  7. **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>`
  8. **Inherited By:** :ref:`ConfirmationDialog<class_ConfirmationDialog>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Base dialog for user notification.
  13. Properties
  14. ----------
  15. +-----------------------------+----------------------------------------------------------------+
  16. | :ref:`bool<class_bool>` | :ref:`dialog_hide_on_ok<class_AcceptDialog_dialog_hide_on_ok>` |
  17. +-----------------------------+----------------------------------------------------------------+
  18. | :ref:`String<class_String>` | :ref:`dialog_text<class_AcceptDialog_dialog_text>` |
  19. +-----------------------------+----------------------------------------------------------------+
  20. Methods
  21. -------
  22. +------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`Button<class_Button>` | :ref:`add_button<class_AcceptDialog_add_button>` **(** :ref:`String<class_String>` text, :ref:`bool<class_bool>` right=false, :ref:`String<class_String>` action="" **)** |
  24. +------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Button<class_Button>` | :ref:`add_cancel<class_AcceptDialog_add_cancel>` **(** :ref:`String<class_String>` name **)** |
  26. +------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Label<class_Label>` | :ref:`get_label<class_AcceptDialog_get_label>` **(** **)** |
  28. +------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`Button<class_Button>` | :ref:`get_ok<class_AcceptDialog_get_ok>` **(** **)** |
  30. +------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`register_text_enter<class_AcceptDialog_register_text_enter>` **(** :ref:`Node<class_Node>` line_edit **)** |
  32. +------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. Signals
  34. -------
  35. .. _class_AcceptDialog_confirmed:
  36. - **confirmed** **(** **)**
  37. Emitted when the dialog is accepted, i.e. the OK button is pressed.
  38. .. _class_AcceptDialog_custom_action:
  39. - **custom_action** **(** :ref:`String<class_String>` action **)**
  40. Emitted when a custom button is pressed. See :ref:`add_button<class_AcceptDialog_add_button>`.
  41. Description
  42. -----------
  43. This dialog is useful for small notifications to the user about an event. It can only be accepted or closed, with the same result.
  44. Property Descriptions
  45. ---------------------
  46. .. _class_AcceptDialog_dialog_hide_on_ok:
  47. - :ref:`bool<class_bool>` **dialog_hide_on_ok**
  48. +----------+-----------------------+
  49. | *Setter* | set_hide_on_ok(value) |
  50. +----------+-----------------------+
  51. | *Getter* | get_hide_on_ok() |
  52. +----------+-----------------------+
  53. 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_confirmed>` signal, and handle hiding the dialog in your own logic. Default value: ``true``.
  54. 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.
  55. .. _class_AcceptDialog_dialog_text:
  56. - :ref:`String<class_String>` **dialog_text**
  57. +----------+-----------------+
  58. | *Setter* | set_text(value) |
  59. +----------+-----------------+
  60. | *Getter* | get_text() |
  61. +----------+-----------------+
  62. The text displayed by this dialog.
  63. Method Descriptions
  64. -------------------
  65. .. _class_AcceptDialog_add_button:
  66. - :ref:`Button<class_Button>` **add_button** **(** :ref:`String<class_String>` text, :ref:`bool<class_bool>` right=false, :ref:`String<class_String>` action="" **)**
  67. 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_custom_action>` signal when pressed.
  68. If ``true``, *right* will place the button to the right of any sibling buttons. Default value: ``false``.
  69. .. _class_AcceptDialog_add_cancel:
  70. - :ref:`Button<class_Button>` **add_cancel** **(** :ref:`String<class_String>` name **)**
  71. Adds a button with label *name* and a cancel action to the dialog and returns the created button.
  72. .. _class_AcceptDialog_get_label:
  73. - :ref:`Label<class_Label>` **get_label** **(** **)**
  74. Return the label used for built-in text.
  75. .. _class_AcceptDialog_get_ok:
  76. - :ref:`Button<class_Button>` **get_ok** **(** **)**
  77. Return the OK Button.
  78. .. _class_AcceptDialog_register_text_enter:
  79. - void **register_text_enter** **(** :ref:`Node<class_Node>` line_edit **)**
  80. Registers a :ref:`LineEdit<class_LineEdit>` in the dialog. When the enter key is pressed, the dialog will be accepted.