# Keydown restricting specific keys?

**URL:** <https://forum.kirupa.com/t/keydown-restricting-specific-keys/28249>\
**Category:** Uncategorized\
**Created:** [August 11, 2003, 8:17pm UTC](https://forum.kirupa.com/t/keydown-restricting-specific-keys/28249 "2003-08-11T20:17:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![emeX](https://avatars.discourse-cdn.com/v4/letter/e/a4c791/32.png) [@emeX](https://forum.kirupa.com/u/emeX)\
**Post date:** [August 11, 2003, 8:17pm UTC](https://forum.kirupa.com/t/keydown-restricting-specific-keys/28249/1 "2003-08-11T20:17:02Z")

</div>

Is there a way to specify a range of keys that i want the keydown method to respond to like a-z,A-Z,0-9,!@#$%^&\*()-+=/?\>.\<,;:"’}]{[  
because when i press shift it does the actions for keydown which i dont want it to do that…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 11, 2003, 8:26pm UTC](https://forum.kirupa.com/t/keydown-restricting-specific-keys/28249/2 "2003-08-11T20:26:19Z")

</div>

umm…i dont know if this will work but you could try onKeyPress and put in ‘a’-‘z’ which should make it respond only to lowercase letters. You are basically setting a limit on the ascii values that it looks for. once again, not sure if this will actually work and I dont have time to test it right now.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 11, 2003, 8:47pm UTC](https://forum.kirupa.com/t/keydown-restricting-specific-keys/28249/3 "2003-08-11T20:47:39Z")

</div>

is it just the shift thing thats bothering you? because if thats all just have something like

if (Key.isDown(Key.SHIFT)) return;

at the top of your onKeyDown so it exits if the shift key is down preventing anything else from being recognized

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 11, 2003, 9:10pm UTC](https://forum.kirupa.com/t/keydown-restricting-specific-keys/28249/4 "2003-08-11T21:10:13Z")

</div>

no actually its a custom text cursor that moves on a keydown but i dont want keys like shift ,control ,the F keys, esc and other keys that have no valid input to move the curosr when they are pressed…  
I saw something somewhere where it used like inputfield.restrict (a-z); or somrthing like that

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 11, 2003, 9:14pm UTC](https://forum.kirupa.com/t/keydown-restricting-specific-keys/28249/5 "2003-08-11T21:14:00Z")

</div>

yeah you can restrict input text. I know that for sure. However, I am not sure if the same method will work for restricting a handler

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 11, 2003, 9:14pm UTC](https://forum.kirupa.com/t/keydown-restricting-specific-keys/28249/6 "2003-08-11T21:14:50Z")

</div>

how about just checking for the change in text from one onChanged to the next and placing the cursor at the end of the character that changed?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 11, 2003, 9:15pm UTC](https://forum.kirupa.com/t/keydown-restricting-specific-keys/28249/7 "2003-08-11T21:15:55Z")

</div>

do u know how? could u give me a example…
