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
parentHudParentBase
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
Properties
FocusHandler
Interface used to manage the element's input focus state.
public IFocusHandler FocusHandler { get; }
Property Value
IsMousedOver
Indicates whether the cursor is currently over the slider box.
public override bool IsMousedOver { get; }
Property Value
Max
The maximum configurable value for the slider.
public float Max { get; set; }
Property Value
Min
The minimum configurable value for the slider.
public float Min { get; set; }
Property Value
MouseInput
Mouse input interface for this clickable element.
public IMouseInput MouseInput { get; }
Property Value
Name
The text displayed in the name label.
public RichText Name { get; set; }
Property Value
NameBuilder
Accessor for the text builder of the name label.
public ITextBuilder NameBuilder { get; }
Property Value
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
UpdateValueCallback
Helper property for registering a value update callback during initialization.
public EventHandler UpdateValueCallback { set; }
Property Value
Value
The value currently set on the slider.
public float Value { get; set; }
Property Value
ValueBuilder
Accessor for the text builder of the value label.
public ITextBuilder ValueBuilder { get; }
Property Value
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
Events
ValueChanged
Invoked when the current value of the slider changes.
public event EventHandler ValueChanged