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
public bool AllowGreater { get; set; }
Property Value
AllowLesser
public bool AllowLesser { get; set; }
Property Value
ExpEdit
If true
, and MinValue is greater than 0, Value will be represented exponentially rather than linearly.
public bool ExpEdit { get; set; }
Property Value
MaxValue
public double MaxValue { get; set; }
Property Value
MinValue
public double MinValue { get; set; }
Property Value
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
Ratio
The value mapped between 0 and 1.
public double Ratio { get; set; }
Property Value
Rounded
If true
, Value will always be rounded to the nearest integer.
public bool Rounded { get; set; }
Property Value
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
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
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_nameName of the method to check for.
Returns
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_nameName of the signal to check for.
Returns
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_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
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
public event Action Changed
Event Type
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