Range
Shared numeric behavior for sliders, scrollbars and progress controls.
Range stores a value and its update rules. For a ready-made UI element, use an appropriate derived class such as HSlider or ProgressBar. Base defaults: MinValue = 0, MaxValue = 100, Value = 0, Step = 1, Page = 0; AllowGreater, AllowLesser, Rounded and ExpEdit are off. Supply finite numbers: NaN is not rejected as an invalid value.
Assigning Value snaps to a positive Step relative to MinValue, then Rounded rounds to an integer, then bounds apply. For example, MinValue = 0.1 and Step = 0.2 produce 0.1, 0.3, 0.5. Step = 0 disables snapping but not Rounded or bounds. Changing Step, Rounded or AllowGreater/AllowLesser does not itself recalculate current Value: assign Value again to apply the new rules.
The ordinary upper bound is MaxValue − Page; the lower bound is MinValue. Page is constrained to 0 through MaxValue − MinValue. It is a page size rather than an increment. AllowGreater/AllowLesser remove the corresponding Value bound. Raising MinValue raises MaxValue if needed; MaxValue cannot remain below MinValue.
Ratio is normalized between MinValue and MaxValue rather than MinValue and MaxValue − Page. With bounds 0/100 and Page = 20, the greatest ordinary Value is 80 and Ratio is 0.8. Assigning Ratio = 1 also stops at Value = 80. Ratio getters clamp to 0…1 even when Value may exceed bounds; equal bounds return 1. For predictable exponential ExpEdit scaling, use 0 < MinValue < MaxValue; a negative minimum falls back to linear scaling.
ValueChanged reports changes to the final value through an ordinary setter for owners inside the tree. Assignments producing the same result emit no signal. Changed reports MinValue, MaxValue, Step or Page changes rather than every setting. SetValueNoSignal updates the value and invokes virtual _ValueChanged on in-tree owners, but does not emit ValueChanged. Do not use it to suppress all subclass logic.
Calling a.Share(b) replaces b’s numeric state with a’s shared state. Value, bounds, step, page, exponential mode and bound permissions become shared; Rounded stays local. Writes through either element are visible to the other, using the rounding policy of the element performing the write. Share immediately notifies target b with Changed and ValueChanged even when the number was equal or b is outside the tree. Unshare retains a copy of current state and detaches the element from its group.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
RangeConstructor
public Range();Creates base numeric state: bounds 0…100, Value = 0, Step = 1, Page = 0. Use a derived Control for a visual slider or indicator.
Properties10
AllowGreaterProperty
public bool AllowGreater { get; set; }Allows Value above MaxValue − Page, default false. Toggling does not recalculate stored Value or emit Changed. Ratio getters remain clamped to 0…1. Shared after Share.
AllowLesserProperty
public bool AllowLesser { get; set; }Allows Value below MinValue, default false. Toggling does not recalculate stored Value or emit Changed. Does not disable Step/Rounded. Shared after Share.
ExpEditProperty
public bool ExpEdit { get; set; }Enables exponential Ratio conversion, default false. Does not logarithmically transform stored Value itself. Use a positive minimum and larger maximum for predictable scaling; negative minimum uses linear conversion. Toggling does not emit Changed/ValueChanged but can invoke _ValueChanged when updating owners.
MaxValueProperty
public double MaxValue { get; set; }Upper range bound, default 100. Inputs below MinValue become MinValue. Changes recalculate Page and Value; the ordinary Value limit is MaxValue − Page.
MinValueProperty
public double MinValue { get; set; }Lower bound, default 0. Changes raise MaxValue if needed, constrain Page, reapply Value rules and emit Changed. Shared after Share.
PageProperty
public double Page { get; set; }Page size, default 0; constrained to 0…MaxValue − MinValue. Reduces the ordinary upper Value limit to MaxValue − Page. Changes reapply Value and emit Changed. Not a scroll increment.
RatioProperty
public double Ratio { get; set; }Normalized 0…1 position across the full MinValue…MaxValue range, respecting ExpEdit. Setter calculates a number and calls ordinary SetValue; Page/Step/Rounded can prevent an exact round trip. Getter returns 1 for equal bounds.
RoundedProperty
public bool Rounded { get; set; }Local integer-rounding setting applied after Step, default false. Not shared by Share and does not recalculate stored Value when toggled. Subsequent bound clamping can produce a fractional value even with Rounded = true.
StepProperty
public double Step { get; set; }Value snapping grid relative to MinValue, default 1. Positive steps apply on the next Value assignment; nonpositive steps disable this grid. Changes emit Changed without recalculating current Value. For fractional input, normally set Step = 0 and Rounded = false.
ValueProperty
public double Value { get; set; }Current number. Setter applies Step, then Rounded, then MinValue/MaxValue − Page bounds subject to AllowLesser/AllowGreater. A changed result emits ValueChanged on in-tree owners. Shared after Share.
Methods24
GetAsRatiodouble
public double GetAsRatio();Normalized 0…1 position across the full MinValue…MaxValue range, respecting ExpEdit. Setter calculates a number and calls ordinary SetValue; Page/Step/Rounded can prevent an exact round trip. Getter returns 1 for equal bounds.
doublePosition normalized over the full range, 0…1 for valid finite settings; 1 for equal bounds.
GetMaxdouble
public double GetMax();Upper range bound, default 100. Inputs below MinValue become MinValue. Changes recalculate Page and Value; the ordinary Value limit is MaxValue − Page.
doubleCurrent stored setting.
GetMindouble
public double GetMin();Lower bound, default 0. Changes raise MaxValue if needed, constrain Page, reapply Value rules and emit Changed. Shared after Share.
doubleCurrent stored setting.
GetPagedouble
public double GetPage();Page size, default 0; constrained to 0…MaxValue − MinValue. Reduces the ordinary upper Value limit to MaxValue − Page. Changes reapply Value and emit Changed. Not a scroll increment.
doubleStored page size rather than a value increment.
GetStepdouble
public double GetStep();Value snapping grid relative to MinValue, default 1. Positive steps apply on the next Value assignment; nonpositive steps disable this grid. Changes emit Changed without recalculating current Value. For fractional input, normally set Step = 0 and Rounded = false.
doubleCurrent stored setting.
GetValuedouble
public double GetValue();Current number. Setter applies Step, then Rounded, then MinValue/MaxValue − Page bounds subject to AllowLesser/AllowGreater. A changed result emits ValueChanged on in-tree owners. Shared after Share.
doubleStored shared value, potentially outside bounds when AllowGreater/AllowLesser permit it.
IsGreaterAllowedbool
public bool IsGreaterAllowed();Allows Value above MaxValue − Page, default false. Toggling does not recalculate stored Value or emit Changed. Ratio getters remain clamped to 0…1. Shared after Share.
boolCurrent stored setting.
IsLesserAllowedbool
public bool IsLesserAllowed();Allows Value below MinValue, default false. Toggling does not recalculate stored Value or emit Changed. Does not disable Step/Rounded. Shared after Share.
boolCurrent stored setting.
IsRatioExpbool
public bool IsRatioExp();Enables exponential Ratio conversion, default false. Does not logarithmically transform stored Value itself. Use a positive minimum and larger maximum for predictable scaling; negative minimum uses linear conversion. Toggling does not emit Changed/ValueChanged but can invoke _ValueChanged when updating owners.
boolCurrent stored setting.
IsUsingRoundedValuesbool
public bool IsUsingRoundedValues();Local integer-rounding setting applied after Step, default false. Not shared by Share and does not recalculate stored Value when toggled. Subsequent bound clamping can produce a fractional value even with Rounded = true.
boolCurrent stored setting.
SetAllowGreatervoid
public void SetAllowGreater(bool allow);Allows Value above MaxValue − Page, default false. Toggling does not recalculate stored Value or emit Changed. Ratio getters remain clamped to 0…1. Shared after Share.
| Name | Type | Default |
|---|---|---|
allow | bool | — |
allowtrue permits values above MaxValue − Page on subsequent writes.
SetAllowLesservoid
public void SetAllowLesser(bool allow);Allows Value below MinValue, default false. Toggling does not recalculate stored Value or emit Changed. Does not disable Step/Rounded. Shared after Share.
| Name | Type | Default |
|---|---|---|
allow | bool | — |
allowtrue permits values below MinValue on subsequent writes.
SetAsRatiovoid
public void SetAsRatio(double value);Normalized 0…1 position across the full MinValue…MaxValue range, respecting ExpEdit. Setter calculates a number and calls ordinary SetValue; Page/Step/Rounded can prevent an exact round trip. Getter returns 1 for equal bounds.
| Name | Type | Default |
|---|---|---|
value | double | — |
valueNormalized position, normally 0…1. Resulting Value additionally passes through Step/Rounded/Page.
SetExpRatiovoid
public void SetExpRatio(bool enabled);Enables exponential Ratio conversion, default false. Does not logarithmically transform stored Value itself. Use a positive minimum and larger maximum for predictable scaling; negative minimum uses linear conversion. Toggling does not emit Changed/ValueChanged but can invoke _ValueChanged when updating owners.
| Name | Type | Default |
|---|---|---|
enabled | bool | — |
enabledtrue enables exponential Ratio conversion; use 0 < MinValue < MaxValue.
SetMaxvoid
public void SetMax(double maximum);Upper range bound, default 100. Inputs below MinValue become MinValue. Changes recalculate Page and Value; the ordinary Value limit is MaxValue − Page.
| Name | Type | Default |
|---|---|---|
maximum | double | — |
maximumFinite upper bound; cannot remain below MinValue.
SetMinvoid
public void SetMin(double minimum);Lower bound, default 0. Changes raise MaxValue if needed, constrain Page, reapply Value rules and emit Changed. Shared after Share.
| Name | Type | Default |
|---|---|---|
minimum | double | — |
minimumFinite lower bound; can raise MaxValue.
SetPagevoid
public void SetPage(double pagesize);Page size, default 0; constrained to 0…MaxValue − MinValue. Reduces the ordinary upper Value limit to MaxValue − Page. Changes reapply Value and emit Changed. Not a scroll increment.
| Name | Type | Default |
|---|---|---|
pagesize | double | — |
pagesizeFinite page size; clamped to 0…MaxValue − MinValue.
SetStepvoid
public void SetStep(double step);Value snapping grid relative to MinValue, default 1. Positive steps apply on the next Value assignment; nonpositive steps disable this grid. Changes emit Changed without recalculating current Value. For fractional input, normally set Step = 0 and Rounded = false.
| Name | Type | Default |
|---|---|---|
step | double | — |
stepFinite step; positive enables snapping, 0 disables it. Current Value is not recalculated.
SetUseRoundedValuesvoid
public void SetUseRoundedValues(bool enabled);Local integer-rounding setting applied after Step, default false. Not shared by Share and does not recalculate stored Value when toggled. Subsequent bound clamping can produce a fractional value even with Rounded = true.
| Name | Type | Default |
|---|---|---|
enabled | bool | — |
enabledtrue enables local integer rounding on subsequent Value writes.
SetValuevoid
public void SetValue(double value);Current number. Setter applies Step, then Rounded, then MinValue/MaxValue − Page bounds subject to AllowLesser/AllowGreater. A changed result emits ValueChanged on in-tree owners. Shared after Share.
| Name | Type | Default |
|---|---|---|
value | double | — |
valueFinite number before snapping, rounding and bounds.
SetValueNoSignalvoid
public void SetValueNoSignal(double value);Applies the same numeric rules as SetValue without ValueChanged. Changes update shared in-tree owners: invoke virtual _ValueChanged and queue redraw. Subclass logic can therefore still run.
| Name | Type | Default |
|---|---|---|
value | double | — |
valueFinite number; ValueChanged is suppressed but virtual callbacks remain.
Sharevoid
public void Share(Entity with);Makes the target Range share this Range’s numeric state, replacing its previous settings. The parameter type is Entity but the object must actually be a Range. Rounded is not shared. Target immediately receives Changed and ValueChanged; take care with handlers that call Share again.
| Name | Type | Default |
|---|---|---|
with | Entity | — |
withExisting target Range that will receive this element’s shared state. Not an arbitrary Entity.
Unsharevoid
public void Unshare();Detaches this element from shared numeric state while retaining current values and settings. Other owners stay in their previous group. The call itself does not emit Changed/ValueChanged.
_ValueChangedvoid
public virtual void _ValueChanged(double newValue);Virtual callback for subclass reactions to value notifications. Called before the signal for ordinary changes, also by SetValueNoSignal, ExpEdit refreshes and Share. A call does not prove a new number or an emitted ValueChanged; ordinary notifications skip out-of-tree owners.
| Name | Type | Default |
|---|---|---|
newValue | double | — |
newValueCurrent shared value; callback can run without a numeric change.
Signals and events2
ChangedEvent
public event Action Changed;MinValue, MaxValue, Step or Page changed. Ordinary Value assignment does not emit it; Share directly emits it on the target. ExpEdit, Rounded and AllowGreater/AllowLesser do not necessarily emit it.
ValueChangedEvent
public event Range.ValueChangedEventHandler ValueChanged;Signal for changed final values through an ordinary setter on in-tree owners. SetValueNoSignal suppresses it; same-result assignments do not emit it. Share directly notifies the target even outside the tree or without a numeric change.
| Name | Type | Default |
|---|---|---|
value | double | — |
valueFinal shared value after Range rules, double.