# Shift Key Creating Box Character

**URL:** <https://discourse.processing.org/t/shift-key-creating-box-character/10197>\
**Category:** Beginners\
**Created:** [April 11, 2019, 6:35pm UTC](https://discourse.processing.org/t/shift-key-creating-box-character/10197 "2019-04-11T18:35:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![clevelandbrowns](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@clevelandbrowns](https://discourse.processing.org/u/clevelandbrowns)\
**Post date:** [April 11, 2019, 6:35pm UTC](https://discourse.processing.org/t/shift-key-creating-box-character/10197/1 "2019-04-11T18:35:58Z")

</div>

When I input characters, my shift keys are producing a box character when pressed. For example, if I’m typing the name Bob, it comes up as [box]Bob. How can I prevent this?

This is for console output by the way.

---

<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:** [April 11, 2019, 6:46pm UTC](https://discourse.processing.org/t/shift-key-creating-box-character/10197/2 "2019-04-11T18:46:07Z")

</div>

[Processing.org/reference/keyTyped\_.html](http://Processing.org/reference/keyTyped_.html)

---

<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:** [April 11, 2019, 7:10pm UTC](https://discourse.processing.org/t/shift-key-creating-box-character/10197/3 "2019-04-11T19:10:33Z")

</div>

I assume SHIFT is CODED

[https://processing.org/reference/keyCode.html](https://processing.org/reference/keyCode.html)

---

<div class="post-metadata">

**Author:** ![clevelandbrowns](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@clevelandbrowns](https://discourse.processing.org/u/clevelandbrowns)\
**Post date:** [April 12, 2019, 12:06am UTC](https://discourse.processing.org/t/shift-key-creating-box-character/10197/4 "2019-04-12T00:06:13Z")

</div>

Neither solves the problem here. I can no longer input text with keyTyped since it prints after pressing the enter key and now enter is not being recognized.  
The CODED bit did not work.  
I just want to know how to avoid the boxes when pressing Shift.

---

<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:** [April 12, 2019, 5:45am UTC](https://discourse.processing.org/t/shift-key-creating-box-character/10197/5 "2019-04-12T05:45:31Z")

</div>

```auto
if(keyCode!=SHIFT) 
    str+=key;

```

---

<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:** [April 12, 2019, 1:07pm UTC](https://discourse.processing.org/t/shift-key-creating-box-character/10197/6 "2019-04-12T13:07:06Z")

</div>

code WITH the box issue:

```auto
String input=""; 

void setup() {
  size(600, 600);
  background(0);
}

void draw() {
  background(0);
  text(input, 
    23, 23);
}

void keyPressed() {
  input += key;
}

```

code without the issue:

using CODED

```auto
String input=""; 

// cursor sign blinks 
boolean cursorBlinkFlag; 
int timerCursorBlink;

void setup() {
  size(600, 600);
  background(0);
}

void draw() {
  background(0);

  fill(255);
  text(input, 
    23, 23);
  showBlinkingCursor(input);
}

// --------------------------------------------------------------------

void keyPressed() {
  if (key == CODED) {
    // CODED: SHIFT, UP, DOWN, etc. 
    if (keyCode == UP) {
      //
    } else if (keyCode == DOWN) {
      //
    }//else if
  } 
  // ----------------------------------------------
  else {
    // NOT CODED
    // add as input
    input += key;
  }//else
  //
}//func 

// --------------------------------------------------------------------

void showBlinkingCursor(String oneLine) {
  // manage and show the red Blinking Cursor |

  if (cursorBlinkFlag) {
    // show text cursor
    fill(255, 0, 0); // RED 
    text("|", 
      23 + textWidth(oneLine), 23);
    // back to normal
    fill(255);
  }//if

  // timer to toggle the flag cursorBlinkFlag
  if (millis()-timerCursorBlink > 330) {
    cursorBlinkFlag = !cursorBlinkFlag; // toggle
    timerCursorBlink = millis();
  }//if
}
//

```
