I am trying to deal with the problem (which I have already discussed in another topic) in a different way.
Does anyone know how to use editText in processing?
Can you have some examples, please?
Only a pure draft example, without unnecessary code, because I will get confused and do not understand anything)
-a- is your question about how to make a user text input field ( or window )
where, while typing, editing the text is possible?
try “textarea” from adding lib ControlP5 or G4P
-b- is your question how to use a specific external tool / code / library
you find somewhere on the internet and want use it in/from processing?
( so providing the link and more info would improve your question )
The question was how to add an input field)
Thank you for responding.
Most likely I already asked this, but:
Products that you make in processing - can they be used for commercial purposes? No license needed, as I understand it? What about Java? Does it have a problem?
The first question applies to libraries. Does it affect commercial use?
If you have an answer, I will be very grateful.
If there is no answer, then thanks so much, you have already helped me out several times, if I’m not mistaken)
You can distribute your sketches all you want, and commercial projects are just fine too, however we place no warranty on the software (see the download page for the license shenanigans).
but you know that, even you export your processing sketch / lets say to a WIN10 app /
still the JAVA sketch code is there as clear text ( not compiled )
but for me processing is a learning environment
( or interactive teaching tool )
and not a production tool ( for commercial software products )
but allow me to say that adding this kind of question
somewhere in between your coding questions
is not the correct / efficient way at a forum
you could make a extra topic after a extensive research about that first, like using: google is your friend
as that question definitely targets other active members as your topic header would attract.
Thanks for the answer.
Yes, it was necessary to ask in a new topic. I apologize, I rarely use forums, I’m not used to these rules and everything.
About thanks to Processing:
Naturally, if it comes out to earn at least something, then I will transfer the denyuzhku to support such a wonderful project.
here is a simple example for edit text or text input (it’s mostly here from the forum, probably GoToLoop)
you can use enter and backspace and type text
Chrisir
// you can use enter and backspace and type text
final int leftMargin = 10;
final int buffMax = 5;
final color BG = 255, FG2 = color(255, 0, 0), FG = 0;
String buff = "";
String result = "";
void setup() {
size(300, 600);
background(BG);
}
void draw() {
background(BG);
// show current text:
fill(FG);
text(buff, leftMargin, 20);
// show cursor
makeRedCursorLine();
// show recent text lines at bottom
fill(FG);
text (result, 23, height-123);
// show line above old text
stroke(FG);
line(0, height-123,
width, height-123);
}
void makeRedCursorLine() {
stroke( frameCount % 30 < 30 >>2 ? BG : FG2 );
int rPos = (int) textWidth(buff) + leftMargin +1;
line(rPos, 9, rPos, 23);
}
void keyPressed() {
int len = buff.length();
// Cursor keys etc.?
if (key==CODED) {
return; // leave here
}
// evaluate key (not coded) :
if (key == RETURN || key == ENTER ) {
// new line
result+="\n"+buff;
buff="";
} else if (key == BACKSPACE) {
// delete last letter
if ( len > 0 ) {
buff = buff.substring(0, len-1);
}
} else {
// normal input: add key to line
buff = buff + key;
}
} // func
//
Dear Chrisir, I tried your code, thanks.
But my problem is that the processing does not see the pressing of Russian keys in android mode.
Do you understand? KeyCode does not change, nothing works, as if there is no pressing.
I saw you in many forum topics, you look quite experienced.
Maybe you know what to do?
If anything, you can easily find my second topic about this. It is relevant, although I wrote my keyboard)) mine is good, but I’m used to the telephone)
The second topic has enough materials.
By the way, here:
Could it be that Russian characters aren’t recognized since they don’t belong to the ASCII codes? Perhaps keyCode, used to detect special keys, is something to look into.