Re: Spin button sugar



Thus spake Mike Kestner:
> The new constructor would set climb_rate to page_incr.  Most users
> currently use either 0.0 or step_incr anyway.  Digits would be derived
> from the precision of step_incr. The page_incr would be set by an
> algorithm like:
> 
> page_incr = MIN (10 * step_incr, (max - min)/10.0)
> 
> For the majority of cases, this would give a usable spin button very
> similar to what people are coding manually.  A large chuck of the
> existing instances have adjustments with a 1/10 step/page ratio.  For
> the less common cases, it's probably best to use the existing
> constructor and roll your own adjustment anyway. 

Re: page_incr:
If you want the `optimal' value, in the sense that one can get to a
given value with the minimum number of clicks, one should set:
page_incr = sqrt (max - min)
(or sqrt ((max - min)/step_incr) * step_incr or whatever);
think of the value as being a 2-digit base sqrt(max-min) number; then
step changes the 1s digit and page_incr changes the 10s (er, most
significant) digit.
(incidentally, you can thus get from one value to any other in at most
 (assume step_incr=1) sqrt(max-min) steps
 (jump to whichever limit min/max is closer, then 1/2 sqrt() steps of
 coarse adjustment, then 1/2 sqrt() steps of fine adjustment)).

However, this kinda thing would result in ugly page_steps (mmm....for
0-1000 it would have a page_incr of 32; 0-200 would be 14) and gross
users out, so it's prolly best to have something like you suggested;
actually, I'd suggest that the default be 
page_incr = 10 * step_incr;
or
page_incr = MAX (10 * step_incr, (max - min)/10.0)
(is this what you meant?)
since page_incr less than ten seem silly to me -- if you're going from
0 to 20, going by 10 is sure better than going by 2.

-- 
  -nils
Public key: http://www.nbarth.net/~nbarth/pub-key.txt

Attachment: pgp6sIvLJkOA8.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]