I've been researching the keyDown operator and I can't seem to find anywhere if its possible to write a program with on keyDown key
without having to deal with non alphabetic chars. Hopefully someone with a bit more experience could let me know how to do this!
Asked
Active
Viewed 198 times
2

Gogol
- 3,033
- 4
- 28
- 57

notHalfBad
- 213
- 2
- 9
-
Please, stop including tags in the title. Only write the question, don't include additional information such as the programming language or the operating system. – Mark May 31 '16 at 10:17
-
When people answer your question, please give feed-back in the comments or by voting up their answers. – Mark May 31 '16 at 10:19
-
yeah, sorry, I only just became able to upvote (yes, I'm that much of a noob on this site, haha). I really do appreciate your answers! – notHalfBad May 31 '16 at 10:28
1 Answers
1
To check that the parameter of the keyDown message contains a letter, check the ASCII value:
if (charToNum(theKey) >= 97 and charToNum(theKey) <= 122) and (charToNum(theKey) >= 65 and charToNum(theKey) <= 90) then
or use the matchText()
function:
if matchText(theKey,"[a-zA-Z]") then

Mark
- 2,380
- 11
- 29
- 49