SpinBox.xml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="SpinBox" inherits="Range" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  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. [codeblock]
  10. var spin_box = SpinBox.new()
  11. add_child(spin_box)
  12. var line_edit = spin_box.get_line_edit()
  13. line_edit.context_menu_enabled = false
  14. spin_box.align = LineEdit.ALIGN_RIGHT
  15. [/codeblock]
  16. The above code will create a [SpinBox], disable context menu on it and set the text alignment to right.
  17. See [Range] class for more options over the [SpinBox].
  18. [b]Note:[/b] [SpinBox] relies on an underlying [LineEdit] node. To theme a [SpinBox]'s background, add theme items for [LineEdit] and customize them.
  19. [b]Note:[/b] If you want to implement drag and drop for the underlying [LineEdit], you can use [method Control.set_drag_forwarding] on the node returned by [method get_line_edit].
  20. </description>
  21. <tutorials>
  22. </tutorials>
  23. <methods>
  24. <method name="apply">
  25. <return type="void" />
  26. <description>
  27. Applies the current value of this [SpinBox].
  28. </description>
  29. </method>
  30. <method name="get_line_edit">
  31. <return type="LineEdit" />
  32. <description>
  33. Returns the [LineEdit] instance from this [SpinBox]. You can use it to access properties and methods of [LineEdit].
  34. [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.
  35. </description>
  36. </method>
  37. </methods>
  38. <members>
  39. <member name="align" type="int" setter="set_align" getter="get_align" enum="LineEdit.Align" default="0">
  40. Sets the text alignment of the [SpinBox].
  41. </member>
  42. <member name="custom_arrow_step" type="float" setter="set_custom_arrow_step" getter="get_custom_arrow_step" default="0.0">
  43. If not [code]0[/code], [code]value[/code] will always be rounded to a multiple of [code]custom_arrow_step[/code] when interacting with the arrow buttons of the [SpinBox].
  44. </member>
  45. <member name="editable" type="bool" setter="set_editable" getter="is_editable" default="true">
  46. If [code]true[/code], the [SpinBox] will be editable. Otherwise, it will be read only.
  47. </member>
  48. <member name="prefix" type="String" setter="set_prefix" getter="get_prefix" default="&quot;&quot;">
  49. Adds the specified [code]prefix[/code] string before the numerical value of the [SpinBox].
  50. </member>
  51. <member name="suffix" type="String" setter="set_suffix" getter="get_suffix" default="&quot;&quot;">
  52. Adds the specified [code]suffix[/code] string after the numerical value of the [SpinBox].
  53. </member>
  54. </members>
  55. <constants>
  56. </constants>
  57. <theme_items>
  58. <theme_item name="updown" data_type="icon" type="Texture">
  59. Sets a custom [Texture] for up and down arrows of the [SpinBox].
  60. </theme_item>
  61. </theme_items>
  62. </class>