loading
 
displaying a number
Roland from South Africa  [107 posts]
3 year
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 Gentner from United States  [1446 posts] 3 year
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.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index