# Ä and RIGHT share the same keyCode. Is that a bug?

**URL:** <https://discourse.processing.org/t/a-and-right-share-the-same-keycode-is-that-a-bug/9926>\
**Category:** Processing\
**Created:** [April 3, 2019, 4:13pm UTC](https://discourse.processing.org/t/a-and-right-share-the-same-keycode-is-that-a-bug/9926 "2019-04-03T16:13:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Schred](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/schred/32/13146_2.png) [@Schred](https://discourse.processing.org/u/Schred)\
**Post date:** [April 3, 2019, 4:13pm UTC](https://discourse.processing.org/t/a-and-right-share-the-same-keycode-is-that-a-bug/9926/1 "2019-04-03T16:13:17Z")

</div>

Hi!  
So I am currently working on a programm with an Excel-table based structure, and I am using Tab, the mouse and the arrow keys for moving. There was this one problem that wasn’t that big of a deal, but always annoyed me: whenever I typed ‘ä’ or ‘Ä’ in, the program would switch to the next field. Turns out ä and the RIGHT-Arrow share the same keyCode: 39. You probably can’t test this on your keyboard, so here’s a screenshot that proves it. Kind of.  
 ![Console](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/5/578f148db3a7d7633b0dd7334bec9ab09f0acffe.png)

---

<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:** [April 3, 2019, 4:27pm UTC](https://discourse.processing.org/t/a-and-right-share-the-same-keycode-is-that-a-bug/9926/2 "2019-04-03T16:27:30Z")

</div>

only have a US keyboard on win7 PC ( english (US) ),  
but allow GE keyboard and use ON SCREEN keyboard give me

 ![SNAG-0053](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/1/1211a8b306b3a06a3eaa48645910881c51ea4c4f.jpeg)

so, please also try the  
`int(key)`  
possibly can distinguish for the arrow keys.

---

<div class="post-metadata">

**Author:** ![Schred](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/schred/32/13146_2.png) [@Schred](https://discourse.processing.org/u/Schred)\
**Post date:** [April 3, 2019, 4:35pm UTC](https://discourse.processing.org/t/a-and-right-share-the-same-keycode-is-that-a-bug/9926/3 "2019-04-03T16:35:44Z")

</div>

@kll You’re right, I could test for that. However the problem stays, and I solved it by checking if `key != 'ä' && 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 3, 2019, 6:10pm UTC](https://discourse.processing.org/t/a-and-right-share-the-same-keycode-is-that-a-bug/9926/4 "2019-04-03T18:10:57Z")

</div>

or use `== CODED`

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

Chrisir

```auto

void setup() {
  size(220, 220);
}
void draw() {
}

void keyPressed() {
  if (key==CODED) {
    // CODED 
    if (keyCode == CONTROL) {
      //CTRL
      println("is a CTRL");
    }//if
  } else {
    // not CODED
    if (key=='ä') {
      println("is an ä");
    }//if
  }//else if
}
//

```

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [April 5, 2019, 11:38pm UTC](https://discourse.processing.org/t/a-and-right-share-the-same-keycode-is-that-a-bug/9926/5 "2019-04-05T23:38:25Z")

</div>

Yes, checking CODED first before checking for RIGHT is the correct way to do this, according to the reference and examples:

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

---

<div class="post-metadata">

**Author:** ![Schred](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/schred/32/13146_2.png) [@Schred](https://discourse.processing.org/u/Schred)\
**Post date:** [April 6, 2019, 9:58am UTC](https://discourse.processing.org/t/a-and-right-share-the-same-keycode-is-that-a-bug/9926/6 "2019-04-06T09:58:58Z")

</div>

Thanks! That is a far better solution that the one I found. 👍
