editText in processing

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)

Attention!
Help affects your karma. :slight_smile:

and what is

editText

-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 )

2 Likes

The question was how to add an input field)
Thank you for responding.

Most likely I already asked this, but:

  1. 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?

  2. 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)

Exit not work. And License Processing - #4 by Architector_4 in this
was suggested to read the FAQ
where you can find this

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 good luck for you, hope you get rich and can give something back
https://processing.org/download/support.html


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.

2 Likes

When you are still interested:

  • 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 
//

Not rules, but simply general tips on how to get help better: :wink:

1 Like

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:

Help affects karma))

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.

2 Likes

Good idea, did you try to say println keyCode?

Thanks for the answer, but I wrote several times that keyCode does not see clicks on Russian letters, as if they were not there at all.

Here is a confirmation of this.
Code:

Between clicks in English letters and numbers, I made more than one click on Russian letters.
Console (result):

Yeah, maybe a apk (?) error, but you wrote him already so we have to wait

1 Like