Hi,
to add a little to the thumbPos story. Make a new slider set its endvalue to 3 as Craig did. Set the script of the slider to
Code: Select all
--on scrollbardrag theValue
-- put theValue + 0 & return & the thumbposition of me + 0 into field 1
--end scrollbardrag
on scrollbardrag theValue
put theValue & return & the thumbposition of me into field 1
end scrollbardrag
drag the slider. Now just comment the second scrollbarDrag handler out and uncomment the first scrollbarDrag handler.
Acutally the thumbposition could not be an integer because LiveCode has to divide the width of the slider by the difference between start- and endValue of the slider. This would rarely be an integer. In contrast the parameter passed to the scrollbarDrag handler (theValue) is an integer and can be used as such.
For me the lesson is: in a scrollbarDrag handler I use the accompanying parameter for integer and if I have to access the thumbposition from a different script always treat it as an decimal and format it as needed. Only set the numberformat of the slider if I want to display fractions of the values on the slider.
Kind regards
Bernd