sliderbug or me being stupid again...?

Wouter wouter.abraham at
Thu Jul 29 03:29:50 CDT 2004

• 	From: Michael J. Lew
	• 	 Subject: RE: sliderbug or me being stupid again...?
	• 	 Date: Wed, 28 Jul 2004 16:47:33 -0700

>>  At 6:39 PM -0400 28/7/04, Wouter wrote:
>> Some weird behavior or am I doing something wrong?
>> recipe:
>> A scrollbar, style set to scale/slider, start value 1, end value  10,
>> show value true
>> A button with the script:
>> on mouseUp
>>    put the thumbpos of sb 1 into tX
>>    repeat with i = 1 to tX
>>      put 0 into item i of tC
>>    end repeat
>>    put "thumbpos:" && tX && "output:" && tC
>> end mouseUp
>> Try different positions of the slidebar.
>> Look at the output with the thumb in the region just before the value
>> shown changes.
>  No, not YOU being stupid, the slider is stupid. I have to admit that  
> that alleged stupidity of the slider is my opinion and it is not  
> shared by Scott Raney (see bug #347).
> Set the numberformat of the slider to "0.00" and look at the results.  
> You can get it to work how you might expect by using round(the  
> thumbposition) in your script. But there is more to it...
> Sliders and scrollbars are far more difficult to work with  
> quantitatively than you might think. The pageIncrement property  
> doesn't determine the increment obtained when you click on the grey  
> bit, it is really the pageInc minus the lineInc. The default lineInc  
> for a new slider object is set to 0 (you can't see it in the object  
> properties inspector but you can query it or set it with the message  
> box). However, it changes if you change the numberformat ("Value  
> format") of the slider! Thus if you have a slider with the  
> numberformat set to show some decimal places you will see that  
> clicking in the grey area of the slider gives you a change of value  
> that is LESS THAN the pageInc ("On bar click") value. Of course, how  
> much less than the expected value depends on the particular  
> numberformat. I find this situation to be awkward every time I try to  
> use a scrollbar or slider object.

Thank you Michael for responding.

The real problem is the value passed.

For example let's say the sb has thumbpos 2.
At a certain point, if you trace the little handler in the debugger,  
you see the value 2 passed to the var tX used for the max amount of  
But the repeat is looping 3 times.
If you first put the thumbpos into a field and take the value form the  
field then it shows 2 and loops 2 times.

This means the value passed from  the sb to the tX var is the trunc  
value and the value passed to the engine is the round value

Anyway I bugzilla'ed this one as I think if the numberformat is not set  
it should pass the value shown by the thumbpos as such.

Hope this is not stupid :-)

More information about the use-livecode mailing list