Calculation errors
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Calculation errors
I am running into calculation errors that seem to be coming from Revolution.
I am reading the settings of three scrollbars using statements of the form:
put the thumbposition of scrollbar "Efield" into Efield
When I display Efield the value is correct. If I move one or more of the scrollbars and then bring them back to their original positions, the values of the variables are always correct but the result of the calculation changes. How can this occur.
Also, if a set a scrollbar to range from 0 to 100 I find that it is not possible to set the scrollbar to either 50 or 150.
I am reading the settings of three scrollbars using statements of the form:
put the thumbposition of scrollbar "Efield" into Efield
When I display Efield the value is correct. If I move one or more of the scrollbars and then bring them back to their original positions, the values of the variables are always correct but the result of the calculation changes. How can this occur.
Also, if a set a scrollbar to range from 0 to 100 I find that it is not possible to set the scrollbar to either 50 or 150.
Here is the part of the script where the problem is occurring
I am using the second PUT statement to watch the values of the variables and the result of part of the calculation
put the thumbposition of scrollbar "mIz" into mIz
put the thumbposition of scrollbar "Efield" into Efield
put the thumbposition of scrollbar "Bfield" into Bfield
if bfield <> 0 then
put scaleFac*sqrt(2*mIz*Efield/(Bfield*Bfield)) into r1
put mIz, Efield, Bfield, 2*mIz*Efield/(Bfield*Bfield)
end if
I am using the second PUT statement to watch the values of the variables and the result of part of the calculation
put the thumbposition of scrollbar "mIz" into mIz
put the thumbposition of scrollbar "Efield" into Efield
put the thumbposition of scrollbar "Bfield" into Bfield
if bfield <> 0 then
put scaleFac*sqrt(2*mIz*Efield/(Bfield*Bfield)) into r1
put mIz, Efield, Bfield, 2*mIz*Efield/(Bfield*Bfield)
end if
Hi Alistair,
I guess that the value of scaleFac changes. Is it posible that the startValue and endValue of the scrollbars change?
Best,
Mark
I guess that the value of scaleFac changes. Is it posible that the startValue and endValue of the scrollbars change?
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Hi Alistair,
I also experienced some strangeness with scrollbars in the past, they were returning fractions althougg I did not set the numberformat of anything else.
The range was from -4 to 4.
So I ended with somthing like:
And my calculations were correct and happy ever after 
Hope that helps.
Best from germany
Klaus
I also experienced some strangeness with scrollbars in the past, they were returning fractions althougg I did not set the numberformat of anything else.
The range was from -4 to 4.
So I ended with somthing like:
Code: Select all
...
put ROUND(the thumbpos of sb "whatever scrollbar") into sb_value
...

Hope that helps.
Best from germany
Klaus
Hi Alistair,
One more idea: add the following brief script to your slider object and make sure to set the showValue of the slider to false or set the pageInc to 0, to hide the tics (you'll need to experiment with what works best for you).
If you use this script while the tics of the slider are visible, you will see that the tics are purely cosmetic and also confusing.
Best,
Mark
One more idea: add the following brief script to your slider object and make sure to set the showValue of the slider to false or set the pageInc to 0, to hide the tics (you'll need to experiment with what works best for you).
Code: Select all
on mouseUp
set the thumbPos of me to round(the thumbPos of me)
end mouseUp
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode