Print new number on screen and removing previous characters

For general Flowcode discussion that does not belong in the other sections.
Post Reply
Xbiotec
Posts: 206
http://meble-kuchenne.info.pl
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 34 times
Been thanked: 25 times

Print new number on screen and removing previous characters

Post by Xbiotec »

hi,
On ESP32 TTGO like below to print number or text, the the printing start at de defined position X and Y. (start to print from left)
when print a number, it could be good to justify it a right and clear the previous characters. May be there is way ?

I tried these 2 ways but not good and difficult to manage well the offset and can not remove the previous first digit!

1- do not use offset , the problem is that numbers are printed from left to right and previous last digit still on display
screen 2.jpg
screen 2.jpg (23.14 KiB) Viewed 4447 times
2- Print of 9999 in green at X and Y position then print 999 in orange at X+offset and Y position. Previous fist digit "9" in green is still on the display too
screen 1.jpg
screen 1.jpg (20.48 KiB) Viewed 4447 times

Do you have a way to solve that? ( cleardisplay is not nice)
thx for your prompt reply
Seb

LeighM
Valued Contributor
Posts: 447
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 81 times
Been thanked: 243 times

Re: Print new number on screen and removing previous characters

Post by LeighM »

Add a space character to the text string.
You might need to do that based on the string length.

stefan.erni
Valued Contributor
Posts: 1002
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 191 times
Been thanked: 217 times

Re: Print new number on screen and removing previous characters

Post by stefan.erni »

Hi lucibel

I wrote a macro for leading space or leading zero in the AppDevelopper.

As a suggestion for number of char: (3)for byte, (5)for uinteger, (6)for sinteger, (10)for ulong, (11)for slong

Maybe it help a little

regards

Stefan
String_leading_space._post_1.fcsx
(12.85 KiB) Downloaded 396 times
leading_space_2021-12-23_19-09-51.png
leading_space_2021-12-23_19-09-51.png (70.84 KiB) Viewed 4433 times
leading_space_2021-12-23_19-11-54.png
leading_space_2021-12-23_19-11-54.png (130.21 KiB) Viewed 4433 times

medelec35
Matrix Staff
Posts: 1917
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 621 times
Been thanked: 645 times

Re: Print new number on screen and removing previous characters

Post by medelec35 »

If you would like to post your flowchart, I can add a couple of examples for you.
Martin

Xbiotec
Posts: 206
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 34 times
Been thanked: 25 times

Re: Print new number on screen and removing previous characters

Post by Xbiotec »

Hi my data are currently numbers right now.
LeighM wrote:
Thu Dec 23, 2021 4:48 pm
Add a space character to the text string.
You might need to do that based on the string length.
So I used ToString$ then checked if number is more or less than 999 .
if more than 999 then add a space to the string.

It work well and was easy to do.
Thx LeighM
Last edited by Xbiotec on Fri Dec 24, 2021 1:18 pm, edited 2 times in total.
Seb

Xbiotec
Posts: 206
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 34 times
Been thanked: 25 times

Re: Print new number on screen and removing previous characters

Post by Xbiotec »

Hi,
I can not send you the complete one who include EEPROM,webserver, networkcom,WLAN, 2 circularbuffers, 2 UARTS, RTC...
So I will send you a simple flowchart.
medelec35 wrote:
Thu Dec 23, 2021 11:48 pm
If you would like to post your flowchart, I can add a couple of examples for you.
Seb

medelec35
Matrix Staff
Posts: 1917
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 621 times
Been thanked: 645 times

Re: Print new number on screen and removing previous characters

Post by medelec35 »

Hi.
A simple flowchart just displaying the numbers will be fine.
Martin

Post Reply