scale w/ ticks and snap-to

Éric Chatonet eric.chatonet at wanadoo.fr
Sun Feb 27 05:24:10 CST 2005


Hi Richard,

Le 27 févr. 05, à 10:18, Richard Gaskin <ambassador at fourthworld.com> a 
écrit :

> I'd like to have a scale in a range from 1 to 5 with 5 ticks on it, and
> with snap-to behavior so this indicator will line up with the ticks.

I made a little mistake in my previous post I think you rectified :-)
startValue must be 1

I take advantage to post a more generic code:
just fix the startValue to 1 and the endValue to the range you desire 
and:

on scrollbarDrag pPos
   set the numberFormat of me to "#"
   set the pageInc of me to the endValue of me / (the endValue of me + 1)
end scrollbarDrag

on mouseUp
   set the numberFormat of me to ".#"
   set the thumbPos of me to round(the thumbPos of me)
end mouseUp

Note that (here with Rev 2.5 and Mac OS X) correct display can't be got 
with some end values as 2, 3, 15 and more than 30.
I figure it's a bug :-(

Regards,

Eric Chatonet.
----------------------------------------------------------------
So Smart Software

Pour les institutionnels, les entreprises et les associations
Des logiciels sur mesure : gestion, multimédia, internet, etc.
Windows, Mac OS et Linux... Avec la "french touch"

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch
----------------------------------------------------------------
Web site		http://www.sosmartsoftware.com/
Email		eric.chatonet at sosmartsoftware.com/
Phone		33 (0)1 43 31 77 62
Mobile		33 (0)6 20 74 50 86
----------------------------------------------------------------


More information about the use-livecode mailing list