Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Math Forum
»
Discussions
»
Software
»
comp.softsys.matlab
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
Slider step, value does not agree with setting when sliding vs. using the arrow
Replies:
16
Last Post:
Mar 4, 2013 1:53 PM




Re: Slider step, value does not agree with setting when sliding vs. using the arrow
Posted:
Mar 1, 2013 6:06 PM


On 3/1/2013 4:23 PM, dpb wrote: > On 3/1/2013 3:50 PM, Nasser M. Abbasi wrote: >> Oh, and before someone replies saying that I can round >> the numbers as I want, yes, I know I can do this, but >> my question is why does the slider does not >> move by the minor/major steps as expected. > ... > > Nothing in documentation indicates that is expected for other than the > movement in the arrow/channel portion of the slider control. When you > position the slider directly, the actual position is returned from > nearest pixel translated to range. This is Windows behavior and afaik > there's no OS support to control the actual slider position to the arrow > minor/major discretization steps. > > IOW, it is the way it is... >
I use rounding now to fix it. So it is not a big deal. But this behavior makes no sense. A user does not care about pixel images and such. The semantics of the behavior of slider should be that it steps by only the minor or major steps as instructed.
Just because Matlab can't do it, does not mean it is not possible. Matlab could have very easily did the rounding internally, just like a user does, so that it keeps the step size to be the minor step size. (it has all the information it needs to do this).
I use Mathematica all the time for doing the same thing, and in Mathematica I can make a slider telling it the steps to move by, and it always returns values by those increments, regardless of how small or large they are. Here is an example (Mathematica uses the third argument for step size, Matlab uses the second argument). Here the step size is 0.001.
Note that there is only one step size for Mathematica slider.
 v = 0; Row[{Slider[Dynamic[v], {0, 1, 0.001}], Dynamic[v]}] 
Screen shot:
http://12000.org/tmp/030113/slider.png
Nasser



