We are about to switch to a new forum software. Until then we have removed the registration on this forum.
So I'm trying to get some keyboard input. Right now, I know that the code to delete the last letter from a string is:
if (key == BACKSPACE)
{
written=written.substring(0,written.length()-1);
}
But I'm showing what's being typed in the window. When I press BACKSPACE, in the window appears the [] symbol. I don't want it to appear and, instead, I want it to be replaced by the new letter the user types.
How to?
Answers
Can't figure out any problems from what you've posted so far.
btW, a working online example: (*)
http://studio.processingtogether.com/sp/pad/export/ro.9Zo$UbIWYZEDR/latest
yes, please post your entire code
btw
you should say
written = written + key;
only when it's not backspace
Greetings!
here....
Sorry. Well, basically my whole code is this (variables are in spanish):
What I'm trying to do is that when hitting BACKSPACE, it removes the last letter. Like normally we use it. That's all. I know how to delete the last letter from a string (using subtstring), but I don't want to see the [] symbol appear. Try it out.
It's somewhat useless posting your code when the bugged part isn't included there! :-w
Besides, there are some indentation inconsistencies. Better use CTRL+T inside Processing's IDE! :-\"
Anyways, @Chrisir has already posted a snippet example on how to do it! And I've posted an online running example too!
http://studio.processingtogether.com/sp/pad/export/ro.9Zo$UbIWYZEDR/latest
Why don't try to adapt the working algorithms to your own program? :>
Your code doesn't use BACKSPACE, that's why you see the rectangle, showing an interpretation of the backspace char...
Likewise, don't use '\n', use ENTER instead.
thanks