class_spinbox.rst 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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 SpinBox.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_SpinBox:
  6. SpinBox
  7. =======
  8. **Inherits:** :ref:`Range<class_Range>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Numerical input text field.
  10. Description
  11. -----------
  12. SpinBox is a numerical input text field. It allows entering integers and floats.
  13. **Example:**
  14. ::
  15. var spin_box = SpinBox.new()
  16. add_child(spin_box)
  17. var line_edit = spin_box.get_line_edit()
  18. line_edit.context_menu_enabled = false
  19. spin_box.align = LineEdit.ALIGN_RIGHT
  20. The above code will create a ``SpinBox``, disable context menu on it and set the text alignment to right.
  21. See :ref:`Range<class_Range>` class for more options over the ``SpinBox``.
  22. Properties
  23. ----------
  24. +-----------------------------------+--------------------------------------------------+----------+
  25. | :ref:`Align<enum_LineEdit_Align>` | :ref:`align<class_SpinBox_property_align>` | ``0`` |
  26. +-----------------------------------+--------------------------------------------------+----------+
  27. | :ref:`bool<class_bool>` | :ref:`editable<class_SpinBox_property_editable>` | ``true`` |
  28. +-----------------------------------+--------------------------------------------------+----------+
  29. | :ref:`String<class_String>` | :ref:`prefix<class_SpinBox_property_prefix>` | ``""`` |
  30. +-----------------------------------+--------------------------------------------------+----------+
  31. | :ref:`String<class_String>` | :ref:`suffix<class_SpinBox_property_suffix>` | ``""`` |
  32. +-----------------------------------+--------------------------------------------------+----------+
  33. Methods
  34. -------
  35. +---------------------------------+----------------------------------------------------------------------+
  36. | void | :ref:`apply<class_SpinBox_method_apply>` **(** **)** |
  37. +---------------------------------+----------------------------------------------------------------------+
  38. | :ref:`LineEdit<class_LineEdit>` | :ref:`get_line_edit<class_SpinBox_method_get_line_edit>` **(** **)** |
  39. +---------------------------------+----------------------------------------------------------------------+
  40. Theme Properties
  41. ----------------
  42. +-------------------------------+--------+
  43. | :ref:`Texture<class_Texture>` | updown |
  44. +-------------------------------+--------+
  45. Property Descriptions
  46. ---------------------
  47. .. _class_SpinBox_property_align:
  48. - :ref:`Align<enum_LineEdit_Align>` **align**
  49. +-----------+------------------+
  50. | *Default* | ``0`` |
  51. +-----------+------------------+
  52. | *Setter* | set_align(value) |
  53. +-----------+------------------+
  54. | *Getter* | get_align() |
  55. +-----------+------------------+
  56. Sets the text alignment of the ``SpinBox``.
  57. ----
  58. .. _class_SpinBox_property_editable:
  59. - :ref:`bool<class_bool>` **editable**
  60. +-----------+---------------------+
  61. | *Default* | ``true`` |
  62. +-----------+---------------------+
  63. | *Setter* | set_editable(value) |
  64. +-----------+---------------------+
  65. | *Getter* | is_editable() |
  66. +-----------+---------------------+
  67. If ``true``, the ``SpinBox`` will be editable. Otherwise, it will be read only.
  68. ----
  69. .. _class_SpinBox_property_prefix:
  70. - :ref:`String<class_String>` **prefix**
  71. +-----------+-------------------+
  72. | *Default* | ``""`` |
  73. +-----------+-------------------+
  74. | *Setter* | set_prefix(value) |
  75. +-----------+-------------------+
  76. | *Getter* | get_prefix() |
  77. +-----------+-------------------+
  78. Adds the specified ``prefix`` string before the numerical value of the ``SpinBox``.
  79. ----
  80. .. _class_SpinBox_property_suffix:
  81. - :ref:`String<class_String>` **suffix**
  82. +-----------+-------------------+
  83. | *Default* | ``""`` |
  84. +-----------+-------------------+
  85. | *Setter* | set_suffix(value) |
  86. +-----------+-------------------+
  87. | *Getter* | get_suffix() |
  88. +-----------+-------------------+
  89. Adds the specified ``suffix`` string after the numerical value of the ``SpinBox``.
  90. Method Descriptions
  91. -------------------
  92. .. _class_SpinBox_method_apply:
  93. - void **apply** **(** **)**
  94. Applies the current value of this ``SpinBox``.
  95. ----
  96. .. _class_SpinBox_method_get_line_edit:
  97. - :ref:`LineEdit<class_LineEdit>` **get_line_edit** **(** **)**
  98. Returns the :ref:`LineEdit<class_LineEdit>` instance from this ``SpinBox``. You can use it to access properties and methods of :ref:`LineEdit<class_LineEdit>`.
  99. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  100. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  101. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`