The enclosed calculates and should displays a range on a slider from the Top value(90) to the Bot value(40).
The button initiates the calcs and displays the answer for the h0.val=65 on t0 and the h0.hig value=150 on t1
Thesw answers are correct, but the slider is located wrong
If I directly enter h0.val=65 and h0.hig=150 in Debug then the slider position is correct
Why the difference?
Also.. I get errors with h0.val=(Top.val+Bot.val)/2 thats why the double line using Calc. A sample of the construct would be nice please
As an integer driven MCU without such things as floating support and others
None complex evaluations and assignments
There is no order of operations
Parsing occurs on operator from left to right.
However, I think your math maybe wrong for your expectation.
- you may want to re-examine.
Slider height is made up of
- range 0 to 100 101 points
- and cursor (height in this case)
So as slider is height of 303 less height of cursor of "after calc" of 150
leaves 153 pixels for range
1 pixel for lowest range, spacing becomes 1.52 pixels per range number
65x1.52+1 pixels 99.8 so integer math 99 from bottom or 204 from top of slider
Slider starts at 75 ... bottom maybe should be at coord y 279
Cursor height is 150 so cursor starts at 130
Now when I place a coloured background text component 150 high at y of 130
and press your button - I get the parallel of slider cursor 1 pixel lower. so close
perhaps the 99.8 1st pixel at top instead of at bottom as I calculated.
So it is working as expected with the code provided. Exactly doing as told.
Yes,, Integer maths is a pain
Try reading what I've written
Parsing Occurs Left to Right on Operator.
Isn't it already stated above -- No?