Table of Contents

Class Range

Abstract base class for controls that represent a number within a range.

Inheritance
Range
Derived

Remarks

Range is an abstract base class for controls that represent a number within a range, using a configured step and page size. See e.g. ScrollBar and Slider for examples of higher-level nodes using Range.

Properties

allow_greater

If true, value may be greater than max_value.

var allow_greater : bool = false

Property Value

bool

Remarks

  • void set_allow_greater(bool value)
  • bool is_greater_allowed

allow_lesser

If true, value may be less than min_value.

var allow_lesser : bool = false

Property Value

bool

Remarks

  • void set_allow_lesser(bool value)
  • bool is_lesser_allowed

exp_edit

If true, and min_value is greater than 0, value will be represented exponentially rather than linearly.

var exp_edit : bool = false

Property Value

bool

Remarks

  • void set_exp_ratio(bool value)
  • bool is_ratio_exp

max_value

Maximum value. Range is clamped if value is greater than max_value.

var max_value : float = 100.0

Property Value

float

Remarks

min_value

Minimum value. Range is clamped if value is less than min_value.

var min_value : float = 0.0

Property Value

float

Remarks

page

Page size. Used mainly for ScrollBar. A ScrollBar's grabber length is the ScrollBar's size multiplied by page over the difference between min_value and max_value.

var page : float = 0.0

Property Value

float

Remarks

ratio

The value mapped between 0 and 1.

var ratio : float

Property Value

float

Remarks

  • void set_as_ratio(float value)
  • float get_as_ratio

rounded

If true, value will always be rounded to the nearest integer.

var rounded : bool = false

Property Value

bool

Remarks

  • void set_use_rounded_values(bool value)
  • bool is_using_rounded_values

step

If greater than 0, value will always be rounded to a multiple of this property's value. If rounded is also true, value will first be rounded to a multiple of this property's value, then rounded to the nearest integer.

var step : float = 0.01

Property Value

float

Remarks

value

Range's current value. Changing this property (even via code) will trigger Range.value_changed signal. Use Range.set_value_no_signal if you want to avoid it.

var value : float = 0.0

Property Value

float

Remarks

Methods

_value_changed(float)

Qualifiers: virtual

Called when the Range's value is changed (following the same conditions as Range.value_changed).

void _value_changed(float new_value)

Parameters

new_value float

set_value_no_signal(float)

Sets the Range's current value to the specified value, without emitting the Range.value_changed signal.

void set_value_no_signal(float value)

Parameters

value float

share(Node)

Binds two Ranges together along with any ranges previously grouped with either of them. When any of range's member variables change, it will share the new value with all other ranges in its group.

void share(Node with)

Parameters

with Node

unshare

Stops the Range from sharing its member variables with any other.

void unshare

Events

changed

Emitted when min_value, max_value, page, or step change.

signal changed

value_changed(float)

Emitted when value changes. When used on a Slider, this is called continuously while dragging (potentially every frame). If you are performing an expensive operation in a function connected to Range.value_changed, consider using a debouncing Timer to call the function less often.

Note: Unlike signals such as LineEdit.text_changed, Range.value_changed is also emitted when value is set directly via code.

signal value_changed(float value)

Parameters

value float