If you want to update a text or a number at a specific location on a graphic LCD, you must first erase the old text/number.
The way I am doing it at the moment is as follow:
- set the foregroundcolor to the backgroundcolor;
- print the old text, which effectively makes it invisible;
- set the foregroundcolor back to what it was;
- print the updated text/number.
That works, but it 'feels' convoluted.
Does anyone know of a simpler way?
Jan
Erasing text on graphic LCD
-
- Posts: 113
- http://meble-kuchenne.info.pl
- Joined: Mon Feb 13, 2023 7:56 pm
- Has thanked: 28 times
- Been thanked: 12 times
-
- Matrix Staff
- Posts: 1940
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 506 times
- Been thanked: 688 times
Re: Erasing text on graphic LCD
The display manager component allows you to define a text area and then when you set the text in the area with a string it should clear the rest of the area for you. Might be useful.
This way it also allows you to define the X,Y coordinate in a single place and then print to the defined space throughout your program without having to keep recalling the coordinates.
This way it also allows you to define the X,Y coordinate in a single place and then print to the defined space throughout your program without having to keep recalling the coordinates.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Matrix Staff
- Posts: 1940
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 506 times
- Been thanked: 688 times
Re: Erasing text on graphic LCD
Hi Jan,
Yes under displays component toolbar, right at the bottom of the list there is a Display Manager component. You need to connect it to the GLCD component and then define the area you want to draw.
Yes under displays component toolbar, right at the bottom of the list there is a Display Manager component. You need to connect it to the GLCD component and then define the area you want to draw.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Re: Erasing text on graphic LCD
Ben a follow-up to the Display Manager if I may.
I was looking at a way to 'page' the display.
Like when switching between an operational screen and a setup screen.
I was thinking I could save a whole screen to memory, display the other screen and then recall the first screen.
Mem wise it would need about 230kByte assuming 3 bytes (color) per pixel, for a complete screen, doable.
Except that I don't see anything in the component that would support reading an individual pixel color.
Maybe RedrawAll from the Display Manager would support that, assuming everything on the display is created with it.
Needs a separate text redraw apparently.
Or is there a simpler way to do this that I'm missing?
Jan
I was looking at a way to 'page' the display.
Like when switching between an operational screen and a setup screen.
I was thinking I could save a whole screen to memory, display the other screen and then recall the first screen.
Mem wise it would need about 230kByte assuming 3 bytes (color) per pixel, for a complete screen, doable.
Except that I don't see anything in the component that would support reading an individual pixel color.
Maybe RedrawAll from the Display Manager would support that, assuming everything on the display is created with it.
Needs a separate text redraw apparently.
Or is there a simpler way to do this that I'm missing?
Jan
-
- Valued Contributor
- Posts: 1604
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 357 times
- Been thanked: 565 times
Re: Erasing text on graphic LCD
Hi
Probably doable but it seems you are eating up memory.
What about just having two branches?
Branch one with B1 variables writes your operational screen with whatever background and fixed graphics etc whilst branch two with B2 variables writes your setup screen? As long as you didn't change any variable, when rewriting that branch again it would appear as before.
Regards
Probably doable but it seems you are eating up memory.
What about just having two branches?
Branch one with B1 variables writes your operational screen with whatever background and fixed graphics etc whilst branch two with B2 variables writes your setup screen? As long as you didn't change any variable, when rewriting that branch again it would appear as before.
Regards
-
- Valued Contributor
- Posts: 1546
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 138 times
- Been thanked: 737 times
Re: Erasing text on graphic LCD
It is possible to buffer the display I did it for a demo here viewtopic.php?f=10&t=1569&p=9135&hilit=Cheeting#p9135
However you need to use less bit depth- - I used 2,4 and 8 bit versions to fit in the available memory (on esp32)
You could use a similar technique to buffer part of the display.
Martin
However you need to use less bit depth- - I used 2,4 and 8 bit versions to fit in the available memory (on esp32)
You could use a similar technique to buffer part of the display.
Martin
Re: Erasing text on graphic LCD
OK, but as each screen is dynamically changing in this part, then that part, this solution means I need to either redraw the complete screen with any change, or somehow keep track on each change for the case I have to redraw the whole screen.chipfryer27 wrote: ↑Tue Jun 13, 2023 8:26 amHi
Probably doable but it seems you are eating up memory.
What about just having two branches?
Branch one with B1 variables writes your operational screen with whatever background and fixed graphics etc whilst branch two with B2 variables writes your setup screen? As long as you didn't change any variable, when rewriting that branch again it would appear as before.
Regards
Right?
Edit - an array of display objects would be a good solution but I don't think FC supports that.
Jan
Last edited by jandidden on Tue Jun 13, 2023 10:47 am, edited 1 time in total.