-->
Page 1 of 1

TFT: how to erase just ONE line of text without clearing scr

PostPosted: Mon Sep 26, 2016 3:50 pm
by Ecoli-557
Anyone else out there working with these TFT screens?
I am printing to the screen as in my button/TFT demo, however, I want to clear just one line of code.
CLS and re-painting the screen takes too long.
Anyone out there have any tricks, pointers, guesses?
Regards.

Re: TFT: how to erase just ONE line of text without clearing

PostPosted: Mon Sep 26, 2016 11:24 pm
by lpservices
Perhaps the easiest way is to reprint the text in the same place, using the background color.

Re: TFT: how to erase just ONE line of text without clearing

PostPosted: Wed Sep 28, 2016 4:46 pm
by Ecoli-557
OK, have a crude solution so I thought I would share it. If you have a menu as in my TFT and button demo AND you want to erase just one line, you 1st need to have those areas in which you want to erase to be a tft.obj.label.
Then, you simply 'paint' a label with the foreground and the background the same color as your menu background right before you update the label.
An example:
Code: Select alllabel1=tft.obj.label("                   ",5,300,225,20,2, tft.rgb(0,0,0), tft.rgb(0,0,0))
tft.text.color(tft.rgb(0,255,255))
tft.text.cursor(5,300)
tft.print("Temp:" & degreesF & " Hum:" & humidity)

This will paint a black label area at the bottom of the TFT screen, then, it will write the values for temperature and humidity.
This works fairly well and you don't have to waste all the time repainting the screen.
Hope this helps someone else.
Regards.