Table of Contents

Class NamedSliderBox

Namespace
RichHudFramework.UI
Assembly
RichHudClient.dll

A composite control containing a horizontal slider box, a name label, and a value label.

Note: The value label is not updated automatically; it must be updated manually via the ValueChanged event.

public class NamedSliderBox : HudElementBase, IReadOnlyHudElement, IReadOnlyHudNode, IReadOnlyHudParent, IClickableElement, IFocusableElement, IValueControl<float>, IValueControl
Inheritance
NamedSliderBox
Implements
Inherited Members

Examples

This example demonstrates the correct way to update the ValueText of a NamedSliderBox.

new NamedSliderBox(parent)
{
    Name = "Some angle",
    Min = -360f, Max = 360f,
    MouseInput = 
    {
        ToolTip = $"This {nameof(NamedSliderBox)} could set an angle for something, or something."
    },
    // Value text is not set automatically. This allows for custom formatting, but
    // requires some additional setup.
    UpdateValueCallback = (obj, args) =>
    {
        var slider = (NamedSliderBox)obj;
        slider.ValueBuilder.SetText($"{slider.Value:F1}°");
    }
};

Constructors

NamedSliderBox()

public NamedSliderBox()

NamedSliderBox(HudParentBase)

public NamedSliderBox(HudParentBase parent)

Parameters

parent HudParentBase

Fields

SliderBox

Slider control inside the labeled slider box. This field can be used to customize the formatting of the slider box.

public readonly SliderBox SliderBox

Field Value

SliderBox

Properties

FocusHandler

Interface used to manage the element's input focus state.

public IFocusHandler FocusHandler { get; }

Property Value

IFocusHandler

IsMousedOver

Indicates whether the cursor is currently over the slider box.

public override bool IsMousedOver { get; }

Property Value

bool

Max

The maximum configurable value for the slider.

public float Max { get; set; }

Property Value

float

Min

The minimum configurable value for the slider.

public float Min { get; set; }

Property Value

float

MouseInput

Mouse input interface for this clickable element.

public IMouseInput MouseInput { get; }

Property Value

IMouseInput

Name

The text displayed in the name label.

public RichText Name { get; set; }

Property Value

RichText

NameBuilder

Accessor for the text builder of the name label.

public ITextBuilder NameBuilder { get; }

Property Value

ITextBuilder

Percent

The current slider value expressed as a percentage (0 to 1) of the range between the Min and Max values.

public float Percent { get; set; }

Property Value

float

UpdateValueCallback

Helper property for registering a value update callback during initialization.

public EventHandler UpdateValueCallback { set; }

Property Value

EventHandler

Value

The value currently set on the slider.

public float Value { get; set; }

Property Value

float

ValueBuilder

Accessor for the text builder of the value label.

public ITextBuilder ValueBuilder { get; }

Property Value

ITextBuilder

ValueText

The text displayed in the value label.

Note: This does not automatically reflect changes to the slider value; you must update this string manually.

public RichText ValueText { get; set; }

Property Value

RichText

Events

ValueChanged

Invoked when the current value of the slider changes.

public event EventHandler ValueChanged

Event Type

EventHandler