class_spinbox.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Numerical input text field.
  13. Properties
  14. ----------
  15. +-----------------------------------+--------------------------------------------------+------+
  16. | :ref:`Align<enum_LineEdit_Align>` | :ref:`align<class_SpinBox_property_align>` | 0 |
  17. +-----------------------------------+--------------------------------------------------+------+
  18. | :ref:`bool<class_bool>` | :ref:`editable<class_SpinBox_property_editable>` | true |
  19. +-----------------------------------+--------------------------------------------------+------+
  20. | :ref:`String<class_String>` | :ref:`prefix<class_SpinBox_property_prefix>` | "" |
  21. +-----------------------------------+--------------------------------------------------+------+
  22. | :ref:`String<class_String>` | :ref:`suffix<class_SpinBox_property_suffix>` | "" |
  23. +-----------------------------------+--------------------------------------------------+------+
  24. Methods
  25. -------
  26. +---------------------------------+----------------------------------------------------------------------+
  27. | :ref:`LineEdit<class_LineEdit>` | :ref:`get_line_edit<class_SpinBox_method_get_line_edit>` **(** **)** |
  28. +---------------------------------+----------------------------------------------------------------------+
  29. Theme Properties
  30. ----------------
  31. +-------------------------------+--------+
  32. | :ref:`Texture<class_Texture>` | updown |
  33. +-------------------------------+--------+
  34. Description
  35. -----------
  36. SpinBox is a numerical input text field. It allows entering integers and floats.
  37. **Example:**
  38. ::
  39. var spin_box = SpinBox.new()
  40. add_child(spin_box)
  41. var line_edit = spin_box.get_line_edit()
  42. line_edit.context_menu_enabled = false
  43. spin_box.align = LineEdit.ALIGN_RIGHT
  44. The above code will create a ``SpinBox``, disable context menu on it and set the text alignment to right.
  45. See :ref:`Range<class_Range>` class for more options over the ``SpinBox``.
  46. Property Descriptions
  47. ---------------------
  48. .. _class_SpinBox_property_align:
  49. - :ref:`Align<enum_LineEdit_Align>` **align**
  50. +-----------+------------------+
  51. | *Default* | 0 |
  52. +-----------+------------------+
  53. | *Setter* | set_align(value) |
  54. +-----------+------------------+
  55. | *Getter* | get_align() |
  56. +-----------+------------------+
  57. Sets the text alignment of the ``SpinBox``.
  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. .. _class_SpinBox_property_prefix:
  69. - :ref:`String<class_String>` **prefix**
  70. +-----------+-------------------+
  71. | *Default* | "" |
  72. +-----------+-------------------+
  73. | *Setter* | set_prefix(value) |
  74. +-----------+-------------------+
  75. | *Getter* | get_prefix() |
  76. +-----------+-------------------+
  77. Adds the specified ``prefix`` string before the numerical value of the ``SpinBox``.
  78. .. _class_SpinBox_property_suffix:
  79. - :ref:`String<class_String>` **suffix**
  80. +-----------+-------------------+
  81. | *Default* | "" |
  82. +-----------+-------------------+
  83. | *Setter* | set_suffix(value) |
  84. +-----------+-------------------+
  85. | *Getter* | get_suffix() |
  86. +-----------+-------------------+
  87. Adds the specified ``prefix`` string after the numerical value of the ``SpinBox``.
  88. Method Descriptions
  89. -------------------
  90. .. _class_SpinBox_method_get_line_edit:
  91. - :ref:`LineEdit<class_LineEdit>` **get_line_edit** **(** **)**
  92. Returns the :ref:`LineEdit<class_LineEdit>` instance from this ``SpinBox``. You can use it to access properties and methods of :ref:`LineEdit<class_LineEdit>`.