Table of Contents

Class Range

Namespace
Godot
Assembly
GodotSharp.dll

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.

public class Range : Control, IDisposable
Inheritance
Range
Implements
Derived
Inherited Members

Constructors

Range()

public Range()

Properties

AllowGreater

If true, Value may be greater than MaxValue.

public bool AllowGreater { get; set; }

Property Value

bool

AllowLesser

If true, Value may be less than MinValue.

public bool AllowLesser { get; set; }

Property Value

bool

ExpEdit

If true, and MinValue is greater than 0, Value will be represented exponentially rather than linearly.

public bool ExpEdit { get; set; }

Property Value

bool

MaxValue

Maximum value. Range is clamped if Value is greater than MaxValue.

public double MaxValue { get; set; }

Property Value

double

MinValue

Minimum value. Range is clamped if Value is less than MinValue.

public double MinValue { get; set; }

Property Value

double

Page

Page size. Used mainly for ScrollBar. ScrollBar's length is its size multiplied by Page over the difference between MinValue and MaxValue.

public double Page { get; set; }

Property Value

double

Ratio

The value mapped between 0 and 1.

public double Ratio { get; set; }

Property Value

double

Rounded

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

public bool Rounded { get; set; }

Property Value

bool

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.

public double Step { get; set; }

Property Value

double

Value

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

public double Value { get; set; }

Property Value

double

Methods

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

SetValueNoSignal(double)

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

public void SetValueNoSignal(double value)

Parameters

value double

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.

public void Share(Node with)

Parameters

with Node

Unshare()

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

public void Unshare()

_ValueChanged(double)

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

public virtual void _ValueChanged(double newValue)

Parameters

newValue double

Events

Changed

Emitted when MinValue, MaxValue, Page, or Step change.

public event Action Changed

Event Type

Action

ValueChanged

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 ValueChanged, consider using a debouncingTimer to call the function less often.

Note: Unlike signals such as TextChanged, ValueChanged is also emitted when value is set directly via code.

public event Range.ValueChangedEventHandler ValueChanged

Event Type

Range.ValueChangedEventHandler