with my number-pad I can put digits in my RichTextLabel as well as one single comma wherever I want it, and I can erase single positions for corrections.
The numbers are being put into another Label simultaneously as well, but not the comma, because I want to use the entered numbers as full integers for backend calculations. So the comma-button simply is not connected to that Label at all. That comma is basically just decoration, it could be any symbol really...
Naturally, with the comma not appearing in my "backend"-Label, erasing it in the RichTextLabel will erase the next digit. So what I'm trying to achieve is my backend-Label to do nothing when the comma is being erased in the RichTextLabel.
I connected my erase-button with the RichTextLabel
var linetext = get_node(rich_text_label).text
get_node(rich_text_label).text = linetext
and the backend-Label
var linetext2 = get_node(back_end_numbers).text
get_node(back_end_numbers).text = linetext2
and I can work with comma and no-comma like this:
var comma = linetext.find(",")
if comma >= 1:
if comma <= 0:
I was trying to have the backend-Label not react with all kinds of variables back and forth, but if I could at least make it not erase a number along with the comma, I couldn't make it continue erasing afterwards again, and I'm at a loss here.
What could be a good way to "pause when the comma is being erased"? I thought that a "thecommaisbeingerased"-signal from within the RichTextLabel could do the trick (--> if the signal fires: return, otherwise: do your erasing...).
How could I set up such a Signal? Or is there another simple way to achieve this?
Any help is much appreciated.
Just a thought: it would be neat if the entered numbers could be copied into the backend-label when confirming (there's a confirm button), just without the comma. Maybe that would be an easier way... how could that be done?