# editText in processing

**URL:** <https://discourse.processing.org/t/edittext-in-processing/13214>\
**Category:** Processing for Android\
**Created:** [August 6, 2019, 4:20pm UTC](https://discourse.processing.org/t/edittext-in-processing/13214 "2019-08-06T16:20:34Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoName](https://avatars.discourse-cdn.com/v4/letter/n/58f4c7/32.png) [@NoName](https://discourse.processing.org/u/NoName)\
**Post date:** [August 6, 2019, 4:20pm UTC](https://discourse.processing.org/t/edittext-in-processing/13214/1 "2019-08-06T16:20:34Z")

</div>

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. 🙂

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [August 7, 2019, 1:54am UTC](https://discourse.processing.org/t/edittext-in-processing/13214/2 "2019-08-07T01:54:01Z")

</div>

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 )

---

<div class="post-metadata">

**Author:** ![NoName](https://avatars.discourse-cdn.com/v4/letter/n/58f4c7/32.png) [@NoName](https://discourse.processing.org/u/NoName)\
**Post date:** [August 7, 2019, 9:06am UTC](https://discourse.processing.org/t/edittext-in-processing/13214/3 "2019-08-07T09:06:34Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [August 7, 2019, 9:58am UTC](https://discourse.processing.org/t/edittext-in-processing/13214/4 "2019-08-07T09:58:38Z")

</div>

[Exit not work. And License Processing - #4 by Architector\_4](https://discourse.processing.org/t/exit-not-work-and-license-processing/12695/4) in this  
was suggested to read the [FAQ](https://github.com/processing/processing/wiki/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](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](https://www.google.com/search?hl=en&as_q=processing+license+commercial&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=&as_occt=any&safe=images&as_filetype=&as_rights=)  
as that question definitely targets other active members as your topic header would attract.

---

<div class="post-metadata">

**Author:** ![NoName](https://avatars.discourse-cdn.com/v4/letter/n/58f4c7/32.png) [@NoName](https://discourse.processing.org/u/NoName)\
**Post date:** [August 7, 2019, 10:08am UTC](https://discourse.processing.org/t/edittext-in-processing/13214/5 "2019-08-07T10:08:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [August 7, 2019, 2:43pm UTC](https://discourse.processing.org/t/edittext-in-processing/13214/6 "2019-08-07T14:43:00Z")

</div>

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

```auto
// 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 
//

```

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [August 7, 2019, 2:46pm UTC](https://discourse.processing.org/t/edittext-in-processing/13214/7 "2019-08-07T14:46:51Z")

</div>

> [@NoName](#):
>
> , I rarely use forums, I’m not used to these rules and everything.

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

- [Processing Forum Guidelines and Advice - Processing 2.x and 3.x Forum](http://Forum.Processing.org/two/discussion/8042/processing-forum-guidelines-and-advice)

---

<div class="post-metadata">

**Author:** ![NoName](https://avatars.discourse-cdn.com/v4/letter/n/58f4c7/32.png) [@NoName](https://discourse.processing.org/u/NoName)\
**Post date:** [August 7, 2019, 8:16pm UTC](https://discourse.processing.org/t/edittext-in-processing/13214/8 "2019-08-07T20:16:18Z")

</div>

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:

 ![Screenshot_20190807-231043](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/1/1f4d1d802f312b381ea8cab45bc7abde6103260c.jpeg)

Help affects karma))

---

<div class="post-metadata">

**Author:** ![Tiemen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tiemen/32/5477_2.png) [@Tiemen](https://discourse.processing.org/u/Tiemen)\
**Post date:** [August 8, 2019, 9:15am UTC](https://discourse.processing.org/t/edittext-in-processing/13214/9 "2019-08-08T09:15:53Z")

</div>

Could it be that Russian characters aren’t recognized since they don’t belong to the [ASCII](http://www.asciitable.com/) codes? Perhaps [keyCode](https://processing.org/reference/keyCode.html), used to detect special keys, is something to look into.

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [August 8, 2019, 10:12am UTC](https://discourse.processing.org/t/edittext-in-processing/13214/10 "2019-08-08T10:12:24Z")

</div>

Good idea, did you try to say println keyCode?

---

<div class="post-metadata">

**Author:** ![NoName](https://avatars.discourse-cdn.com/v4/letter/n/58f4c7/32.png) [@NoName](https://discourse.processing.org/u/NoName)\
**Post date:** [August 8, 2019, 1:00pm UTC](https://discourse.processing.org/t/edittext-in-processing/13214/11 "2019-08-08T13:00:03Z")

</div>

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:

 ![Screenshot_20190808-155633](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/8ae7dc3e40741e4e5c8582573f807e789957a1ec.png)

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

 ![Screenshot_20190808-155630](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/1/19edc073d1b98f96488d6e4a21e10f5933d887b8.png)

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [August 8, 2019, 2:30pm UTC](https://discourse.processing.org/t/edittext-in-processing/13214/12 "2019-08-08T14:30:53Z")

</div>

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