[fixed] Restrict range of InputBox input
Hello,
In earlier versions, you could restrict the range of acceptable input for a (numeric) input box as follows:
1. create a slider for a number n and set the min, max values for the slider
2. create an input box for n: InputBox[n]
Then, any input typed into the textbox will be restricted to the range [min, max]. If the user enters something outside this range, it gets 'clamped' to min/max.
It seems that this behaviour has changed in recent versions - now if the user types an input out of the slider's range, the min, max settings for the slider get increased. I notice it's also possible to input a non-integer value for an integer slider.
Is there an easy way to restore the previous behaviour? A few of my applets were relying on it. If not, I could use scripting to enforce the ranges, but that's not as maintainable...
Thanks
Anthony
hi
you can something like this, using a nested condition:
input=If[n<min, min, If[n>max, max, n]]
https://ggbm.at/1576837
An added problem.
If you create
min=0
max=15
and use these for the slider's min and max settings, then a value of 20 in the input box changes these values back to numbers.
Setting the slider as fixed makes no difference.
Simon
Thanks, fixed for next release
Thanks for another quick fix! :)
Comments have been locked on this page!