Pre-Populate slider parameters?

Hi, Im an old grasshopper user but newish to programming for it (C#)

I need to have a number slider automatically set the decimal points, min, max and default value when a user drags to it from my component, instead of three decimals and 0 - 1

Is there an example anywhere I can follow on this please?

Many thanks

Do you want to create a connected number slider whenever one of your components is instantiated, or do you want to modify any existing slider when it gets connected to one of your inputs?

Hi David.

To have the slider properly populated when a user connects it.

Although the otherway having slider come out with the tool would work too. Whichever is simpler.

Thank you

The difficult bit is the same in either case, you just have to decide whether you want to mess with existing sliders. It may upset users. Also, if a slider is used to feed two parameters both of which have different demands, who wins?

I’ll come up with an example.

See attached.
slidercomponent.cs (3.7 KB)

Many thanks, much appreciated ill post the result later!

Ok, Worked, thank you. defaults all back to 1, but that’s fine. less work than having to configure every slider.

1 Like