The many faces of the thumb position

James Hurley jhurley0305 at sbcglobal.net
Sat Jan 29 14:54:12 EST 2011


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. 



More information about the Use-livecode mailing list