SpinBox

Inherits:Range<Control<CanvasItem<Node<Object

Numerical input text field.

Description

SpinBox is a numerical input text field. It allows entering integers and floats.

Example:

varspin_box=SpinBox.new()add_child(spin_box)varline_edit=spin_box.get_line_edit()line_edit.context_menu_enabled=falsespin_box.align=LineEdit.ALIGN_RIGHT

The above code will create aSpinBox, disable context menu on it and set the text alignment to right.

SeeRange class for more options over theSpinBox.

Note:SpinBox relies on an underlyingLineEdit node. To theme aSpinBox's background, add theme items forLineEdit and customize them.

Properties

Align

align

0

bool

editable

true

String

prefix

""

String

suffix

""

Methods

void

apply()

LineEdit

get_line_edit()

Theme Properties

Texture

updown

Property Descriptions

Default

0

Setter

set_align(value)

Getter

get_align()

Sets the text alignment of theSpinBox.


Default

true

Setter

set_editable(value)

Getter

is_editable()

Iftrue, theSpinBox will be editable. Otherwise, it will be read only.


Default

""

Setter

set_prefix(value)

Getter

get_prefix()

Adds the specifiedprefix string before the numerical value of theSpinBox.


Default

""

Setter

set_suffix(value)

Getter

get_suffix()

Adds the specifiedsuffix string after the numerical value of theSpinBox.

Method Descriptions

  • voidapply()

Applies the current value of thisSpinBox.


Returns theLineEdit instance from thisSpinBox. You can use it to access properties and methods ofLineEdit.

Warning: 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 theirCanvasItem.visible property.

Theme Property Descriptions

Sets a customTexture for up and down arrows of theSpinBox.