Welcome to Programming LiveCode Q&A, where you can ask questions and receive answers from other members of the community.

Please, ask questions about the book only. If possible, mention section or page number. Don't ask for opinions, ask clear and direct questions only.

Go to main site

Quick Links

Frequently Asked Questions

Errata (1st print)

Not necessary to round the value returned by scrollbarDrag

0 votes
p. 124, bottom:

It seems that the rounding is not necessary, because scrollbarDrag transmits an integer as long as you don't define a numberformat (or value format depending of how you did set the preferences) in the slider's inspector. To check it, just create a slider with 0 as startValue and 1 as endValue. Don't fill the numberFormat (or, for an equivalent result, set it to 0). You can made the slider as long as you want. Set the handler:

on scrollbarDrag theValue

    put theValue into fld 1

end scrollbarDrag

When you drag the slider "thumb", field 1 will contain 0 for any position above (or left) to the middle point of the slider, 1 for any position below or right to this point.

Now, if you go back to the inspector and set the numberformat to, say, "0.000", the field will show any value between 0.000 and 1.000, depending on the slider thumb position.

I checked it with LC 5.5.4 and 6 - but if I remember well, the introduction of the numberFormat for scrollbars is relatively recent, this part of the book was probably written with an earlier version (I didn't keep older versions and cannot check it).
asked Jun 3, 2013 by jhausser (730 points)
edited Jul 17, 2013 by mark

1 Answer

0 votes
This has been corrected in the second print.
answered Jun 3, 2013 by mark (3,090 points)
edited Jul 17, 2013 by mark
...