loading
 
displaying a number
Roland from South Africa  [101 posts]
22 days
Hi Steven

I want to display a number variable, huge, on the screen, pretty much like a voltmeter.

The problem is that the display jumps all the time.
A few things I've tried;

Fixing the trailing digits
V_disp  = Round(V_actual,3)
but if the last digit is 0 then it does not show

So I added;
V_actual = V_actual +.001111
which will ensure there is always a trailing digit > 0
But because of the font and being centre justified, it still jumps too much.

Then I split the number into separate strings with  mid(V_actual,n,1) and displayed each one separately, but then the decimal place moves as the number increases. Negative numbers also mess up the justification.

Is there a way to display a value where the decimal point would stay fixed on the screen, irrespective of the number of leading or trailing digits, or polarity? (just like an instrument display)
(I'm using 2.76.1)

Regards
Roland
Steven from United States  [1432 posts] 19 days
Roland,

You mentioned a different solution on another thread (loading in actual image digits as needed) but in case you want another method I'd try using FormatNumber.

SetVariable "var_to_show", FormatNumber(V_actual,2)

which should set the variable with 2 decimal places. Once SetVariable runs the "number" will be interpreted as a string and should show using DisplayVariable as a 2 digit decimal number even with a zero.

STeven.

 Reply  New Post   Forum Index