How do I clear digits left behind?


I am using a library from Bodmer ,this is a previous older version with the following files

(Adafruit_GFX_AS , Adafruit_ILI9341 , Adafruit_ILI9341_FAST )

Is there any solution for clearing the digits left behind on the right hand side when the number gets smaller?

Writing spaces does not help.

tft.fillScreen (redraw screen) causes a flicker ,very bad if the number is updated every 1 sec.

Thanks in advance.

Assign two colors :
"setTextColor(uint16_t color, uint16_t backgroundcolor);"

(write an extra 'space' it text is shorter then the previous one)

Writing spaces does not help.

That works for character displays.

In this case you can erase the old data by filling a rectangle with the background color.


Thanks for the reply ,I will play around a bit.

Just thought there was something in the library that I did not know of.

I was thinking of converting one of the less common characters to all zero's to get a real

space printed,but that part of the library is beyond me.(Dont know if it is even possible).


Go on. Bodmer has many facilities for formatting and printing text (and digits).

Yes, left-aligned numeric values look untidy. So right-align them.
Many proportional fonts have constant width digits. So that cash columns look nice.

As Don has suggested, paint the background before printing the new digits.
But I am pretty sure that Bodmer will let you draw solid background digits with all its fonts.


Thanks Ny.

Using setTextColor does print spaces and clears the previous content.

I tried spaces before without setTextColor....Thanks.


Bodmers new library does not support the ILI9163 ,I am still battling to change the controller register setup.

I manage to change the previous (older) library from Bodmer, but the new library is still a challenge ,I

totally killed it once and deleted every thing,will open the zip file again ...soon.


You can also right-align the numbers by printing a leading space based on whether the number is a two-digit or three-digit number (or more):

if (number < 100) display.print(" ");
if (number < 10) display.print(" ");

You can change the spaces to zeros if want to display leading zeros instead.


Why didn't I think of that?

David_prentice also pointed me in that direction.