The many faces of the thumb position

dunbarx at dunbarx at
Sat Jan 29 21:13:20 EST 2011


And setting the numberformat property, which I thought might force the value x to show decimals, does not. That number is indeed always an integer. It does force the "x+1 value to display according to the format, useless as that is.

Here is one for you. Set the numberFormat to "0.0". Now drag slowly. The "x+1" value tracks the "x" value, but always changes by 0.1. That is, the decimal value simply counts up or down by 0.1 at regular intervals as you drag either left or right. No longer odd, or even buggy. Bogus.

I guess you always need to set the numberformat to "0" before trying anything as outlandish as you did.

Craig Newman

-----Original Message-----
From: James Hurley <jhurley0305 at>
To: use-livecode at
Sent: Sat, Jan 29, 2011 2:54 pm
Subject: The many faces of the thumb position

I dissevered this the hard way.

Put this into the script of  a scrollbar:

on scrollbardrag 
   put the thumbposition of me into x
   put x into field 1
   put x*1  into field 2
end scrollbardrag

You will find that field 1 gets the round(x) while field 2 gets the decimal 
value of the thumb position, that is you may see 2 into field 1 but 2.3455 in 
field 2.

Furthermore, if one puts x into a variable, the script window shows only the 
round value. But if you use that value in a calculation the value becomes the 
decimal value.

It is helpful to have access to the decimal value of the thumb position, but it 
is confusing to see only the round of that value in the editor.

Is this an old issue that I am just stumbling over?

Jim Hurley

P.S. If you use "On scrollbardrag x" in the script of the scroll bar, then x is 
ONLY the whole number value of the scrollbar value. 

Beware of other scripts that use the scrollbar thumb position. That position 
will be DISPLAYED  as the whole number in the script, but will ACT as the 
decimal value of the thump position. This really hung me up. 
use-livecode mailing list
use-livecode at
Please visit this url to subscribe, unsubscribe and manage your subscription 



More information about the Use-livecode mailing list