class_spinbox.rst 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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>` |
  17. +-----------------------------------+--------------------------------------------------+
  18. | :ref:`bool<class_bool>` | :ref:`editable<class_SpinBox_property_editable>` |
  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 :ref:`SpinBox<class_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 :ref:`SpinBox<class_SpinBox>`.
  46. Property Descriptions
  47. ---------------------
  48. .. _class_SpinBox_property_align:
  49. - :ref:`Align<enum_LineEdit_Align>` **align**
  50. +----------+------------------+
  51. | *Setter* | set_align(value) |
  52. +----------+------------------+
  53. | *Getter* | get_align() |
  54. +----------+------------------+
  55. Sets the text alignment of the :ref:`SpinBox<class_SpinBox>`.
  56. ----
  57. .. _class_SpinBox_property_editable:
  58. - :ref:`bool<class_bool>` **editable**
  59. +----------+---------------------+
  60. | *Setter* | set_editable(value) |
  61. +----------+---------------------+
  62. | *Getter* | is_editable() |
  63. +----------+---------------------+
  64. If ``true``, the :ref:`SpinBox<class_SpinBox>` will be editable. Otherwise, it will be read only.
  65. ----
  66. .. _class_SpinBox_property_prefix:
  67. - :ref:`String<class_String>` **prefix**
  68. +----------+-------------------+
  69. | *Setter* | set_prefix(value) |
  70. +----------+-------------------+
  71. | *Getter* | get_prefix() |
  72. +----------+-------------------+
  73. Adds the specified ``prefix`` string before the numerical value of the :ref:`SpinBox<class_SpinBox>`.
  74. ----
  75. .. _class_SpinBox_property_suffix:
  76. - :ref:`String<class_String>` **suffix**
  77. +----------+-------------------+
  78. | *Setter* | set_suffix(value) |
  79. +----------+-------------------+
  80. | *Getter* | get_suffix() |
  81. +----------+-------------------+
  82. Adds the specified ``prefix`` string after the numerical value of the :ref:`SpinBox<class_SpinBox>`.
  83. Method Descriptions
  84. -------------------
  85. .. _class_SpinBox_method_get_line_edit:
  86. - :ref:`LineEdit<class_LineEdit>` **get_line_edit** **(** **)**
  87. Returns the :ref:`LineEdit<class_LineEdit>` instance from this :ref:`SpinBox<class_SpinBox>`. You can use it to access properties and methods of :ref:`LineEdit<class_LineEdit>`.