From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Slider step, value does not agree with setting when sliding vs.
 using the arrow
Date: Fri, 01 Mar 2013 17:06:14 -0600
Organization: NNTP Server
Lines: 49
Message-ID: <kgrc95$m4o$>
References: <kgr5u5$481$> <kgr7rp$9gu$> <kgr9oi$f8k$>
Reply-To: <HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3
X-Notice: Filtered by postfilter v. 0.8.2
Xref: comp.soft-sys.matlab:790137

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: