Is there a way to make a number slider in rhino?

I’m building UI and I would like to have a number slider. Has anyone built one of these? if so how? Also so you agree that number sliders would be a good thing to add to RhinoCommon UI?

There is the Number Stepper and the Slider in Eto, what would you change about these to get your desired control? :slight_smile:

using Eto.Drawing;
using Eto.Forms;

var stepperLabel = new Label() { Text =  "0" };
var sliderLabel = new Label() { Text =  "0" };

var stepper = new NumericStepper();
var slider = new Slider() { Value = 0, MinValue = -100, MaxValue = 100};

stepper.ValueChanged += (s,e) => stepperLabel.Text = stepper.Value.ToString();
slider.ValueChanged += (s,e) => sliderLabel.Text = slider.Value.ToString();

var layout = new DynamicLayout() { Spacing = new Size(4, 8), Padding = 8 };
layout.BeginVertical();
layout.Add(stepper);
layout.Add(stepperLabel);
layout.AddSpace(true, true);
layout.Add(slider);
layout.Add(sliderLabel);
layout.EndVertical();

var dialog = new Dialog()
{
    Width = 300,
    Height = 140,
    Content = layout
};

dialog.ShowModal();

2 Likes