Can number slider be 'button'-controlled?

Hi everyone,

In many cases I want to change the number from number slider by "button-click’ (say, click + to increase 1, and click - to decrease 1) instead of dragging. Is there any component to realize this?
Thank you all!

Yes this is possible with metahopper and a script. Not with ‘+’ or ‘1’ but with f-keys or other buttons which aren’t used for other things in Grasshopper.

See the definition attached:

Thanks @Mahdiyar

f5_f6_f7_f8_insert_hotkey.gh (19.8 KB)

2 Likes

Thank you so much @martinsiegrist !
However, I tried you code but it dosen’t work.
I don’t why…

Do you have metahopper installed?

Not sure if you’re trying to use this on a mac. I think it only works on windows

Hi,
Yes, I installed it. And I am running on Windows.

So what does not work?

When I press ‘Button’, it just shows ‘True’ in the panel, but no other things change.
Thank you.

You don’t need to click a button, you need to hit F5-F8 or Insert…

1 Like

That’s so cool!!
Sorry I didn’t catch your idea…
That’s really a fantastic work.
Thanks again!

2 Likes

Aha, now I think I also understand what you actually wanted… a button to change a slider value…

The benefit of the function keys is that you don’t need to navigate to a button in your Grasshopper definition. You can be anywhere in the definition and do something with a function key…

2 Likes

I know this is solved, but I wanted to see if I could do it. So here is a way to “control” sliders using buttons without any plugins. It will increment the sliders matching the input names by their smallest increment value. so an integer slider will increase/decrease by 1, but a slider with 4 decimal places will increase/decrease by 0.0001.

changesliderwithbuttons.gh (6.4 KB)

7 Likes

That’s very cool and exactly what I originaly want!
Thank you so much, @jaymezd , for your amazing contribution!
Have nice weekend!

2 Likes

Hi @jaymezd, could you please try one more step:
When I press +/- and HOLD it, could the number add/minus continuously?
Now when I hold it, the number just changes once.
Thank you so much!

It is actually very easy to do that. all you have to do is connect a timer/trigger component to the c#, and set the interval to something you like. Like this:

1 Like

Hi @jaymezd,
That’s a great solution! I love it!
Thank you so much to reply in the weekend!

1 Like