scale w/ ticks and snap-to

Éric Chatonet eric.chatonet at wanadoo.fr
Wed Mar 2 12:52:46 EST 2005


Hi Richard, Paul and Ken,

In my last post, point 3 was nonsense ;-)

> 3. In the scrollbarDrag handler, I prefer set the thumbPos of me to 
> round(the thumbPos of me) to set the thumbPos of me to the thumbPos of 
> me:
> Using round function allows the cursor to follow exactly the mouse 
> movement and snap gently at mouseUp
> Without round function,  the cursor snaps when the mouse is down (it 
> always wins this terrific struggle...) and I don't like interface 
> elements that don't obey to the user (i.e. me  :-)

In fact, you are right: using the round function is unnecessary.
The difference is that you use set the thumbPos of me to the thumbPos 
of me in a scrollbarDrag handler and I use it in the mouseUp handler.
So the cursor follows exactly the mouse movement and snap gently at 
mouseUp or snaps when scrollbarDragging...

Best regards,

Le 2 mars 05, à 16:22, Richard Gaskin <ambassador at fourthworld.com> a 
écrit :

> Éric Chatonet wrote:
>> I proposed a little script to manage a scrollbar with snap-to behavior
>> so the indicator lines up with the ticks (displayed with Mac OS).
>> In fact, my script (changing the numberFormat property) was too much
>> complicated.
>> The following code is enough to do the job:
>>
>> on scrollbarDrag pPos
>>   set the pageInc of me to the endValue of me / (the endValue of me + 
>> 1)
>> end scrollbarDrag
>> --------------------------------
>> on mouseUp
>>   set the thumbPos of me to round(the thumbPos of me)
>> end mouseUp
>
> The behavior seems to work the same here for me with a script 
> containing
> only:
>
> on mouseUp
>    set the thumbPos of me to the thumbpos of me
> end mouseUp
>
> Since the thumbpos is an integer, it does the post-drag snap-to.  I had
> hoped to find a snap-as-you-go behavior, and I've gotten close but it's
> still a tad jerky (if only we had a preScrollBarDrag message <g>).
>
> But here's where things get freaky - try this at home:
>
> 1. Make a new mainstack
> 2. Drop a scale onto it
> 3. Set these properties:
>       startValue: 1
>       endValue:   5
>       pageInc:    1
>       lineInc:    0
>       thumbsize:  1
>
> Freak-o-rama:  I see a slider with 4 (count 'em, four!) tick marks.
> With a scale of 1 to 5, I would expect 5.
>
> Ultra-freak-o-rama:  Éric's has the same properties set just like mine,
> but his has 5 (count 'em, five!) tick marks.
>
> Works the same in Rev and MC.
>
> The mystery deepens: I can copy Éric's, change the endValue to 6, and
> get 6 tick marks.  But if I change the endValue to 4 I get 3 tick 
> marks.
>
> How comes such to be?  :\
>
> You can examine both scrollbars here:
>
>    go url "http://fourthworld.net/scroll_bar_test.mc"
>
> Paul Looney, Ken Ray, and I have scratched our heads over this today.
>
> Mystified?
>
> It turns out that while Eric's first handler doesn't affect behavior, 
> it
> does affect appearance.  This bit:
>
>   on scrollbarDrag pPos
>    set the pageInc of me to the endValue of me/(the endValue of me +1)
>   end scrollbarDrag
>
> ...apparently takes care of a bug in the engine.  As soon as you scroll
> it you get the tick marks appearing as you would expect.  Apparently
> this continues to work even with that handler disabled until the next
> time the pageInc or thumbSize is set.
>
> I could't find a Bugzilla report for this, so I just filed one:
> <http://support.runrev.com/bugdatabase/show_bug.cgi?id=2644>
>
> Freaky, but at least there's a workaround.
>
> Thanks, Éric.

Amicalement,

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