SpinBox.xml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="SpinBox" inherits="Range" version="4.0">
  3. <brief_description>
  4. Numerical input text field.
  5. </brief_description>
  6. <description>
  7. SpinBox is a numerical input text field. It allows entering integers and floats.
  8. [b]Example:[/b]
  9. [codeblocks]
  10. [gdscript]
  11. var spin_box = SpinBox.new()
  12. add_child(spin_box)
  13. var line_edit = spin_box.get_line_edit()
  14. line_edit.context_menu_enabled = false
  15. spin_box.align = LineEdit.ALIGN_RIGHT
  16. [/gdscript]
  17. [csharp]
  18. var spinBox = new SpinBox();
  19. AddChild(spinBox);
  20. var lineEdit = spinBox.GetLineEdit();
  21. lineEdit.ContextMenuEnabled = false;
  22. spinBox.Align = LineEdit.AlignEnum.Right;
  23. [/csharp]
  24. [/codeblocks]
  25. The above code will create a [SpinBox], disable context menu on it and set the text alignment to right.
  26. See [Range] class for more options over the [SpinBox].
  27. [b]Note:[/b] [SpinBox] relies on an underlying [LineEdit] node. To theme a [SpinBox]'s background, add theme items for [LineEdit] and customize them.
  28. </description>
  29. <tutorials>
  30. </tutorials>
  31. <methods>
  32. <method name="apply">
  33. <return type="void" />
  34. <description>
  35. Applies the current value of this [SpinBox].
  36. </description>
  37. </method>
  38. <method name="get_line_edit">
  39. <return type="LineEdit" />
  40. <description>
  41. Returns the [LineEdit] instance from this [SpinBox]. You can use it to access properties and methods of [LineEdit].
  42. [b]Warning:[/b] 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 [member CanvasItem.visible] property.
  43. </description>
  44. </method>
  45. </methods>
  46. <members>
  47. <member name="align" type="int" setter="set_align" getter="get_align" enum="LineEdit.Align" default="0">
  48. Sets the text alignment of the [SpinBox].
  49. </member>
  50. <member name="editable" type="bool" setter="set_editable" getter="is_editable" default="true">
  51. If [code]true[/code], the [SpinBox] will be editable. Otherwise, it will be read only.
  52. </member>
  53. <member name="prefix" type="String" setter="set_prefix" getter="get_prefix" default="&quot;&quot;">
  54. Adds the specified [code]prefix[/code] string before the numerical value of the [SpinBox].
  55. </member>
  56. <member name="suffix" type="String" setter="set_suffix" getter="get_suffix" default="&quot;&quot;">
  57. Adds the specified [code]suffix[/code] string after the numerical value of the [SpinBox].
  58. </member>
  59. <member name="update_on_text_changed" type="bool" setter="set_update_on_text_changed" getter="get_update_on_text_changed" default="false">
  60. Sets the value of the [Range] for this [SpinBox] when the [LineEdit] text is [i]changed[/i] instead of [i]submitted[/i]. See [signal LineEdit.text_changed] and [signal LineEdit.text_submitted].
  61. </member>
  62. </members>
  63. <theme_items>
  64. <theme_item name="updown" data_type="icon" type="Texture2D">
  65. Sets a custom [Texture2D] for up and down arrows of the [SpinBox].
  66. </theme_item>
  67. </theme_items>
  68. </class>