Shop OBEX P1 Docs P2 Docs Learn Events
vgatext.spin Variable display reset — Parallax Forums

vgatext.spin Variable display reset

joethumphreyjoethumphrey Posts: 25
edited 2011-11-23 09:43 in Propeller 1
Hello all,

Using the VGA_TEXT.spin object in code I keep getting an instance when a displayed variable drops below the last character length the variables old last value is still displayed.


For instance:
text.str(string($A,12,$B,10,"Speed-fpm     " ))
    text.dec(Card)

Displays properly until speed drops below the last digit count.

100 fpm displays fine until it drops below that. That leaves me with the first 2 characters being updated leaving the last as it was.

Is there a way to fix this?

Thanks, Joe

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2011-11-22 16:25
    You could print 3 more spaces followed either by X adjustment (back by 3) or 3 backspaces:
    text.str(string($A,12,$B,10,"Speed-fpm     ", "   ", 8, 8, 8))
    
    Alternatively you could introduce a print_numeric method which outputs a decimal number left/right justified including spaces for a fixed width (which would cover the max value).
  • RaymanRayman Posts: 14,851
    edited 2011-11-22 17:35
    You may just want to include the Simple_Numbers object (i.e., as "num")...
    Then you could do: text.str(num.decf(card,4))
  • joethumphreyjoethumphrey Posts: 25
    edited 2011-11-23 09:43
    Awesome, simple numbers displays perfectly.

    Thanks everyone.

    How do I mark this as solved?
Sign In or Register to comment.