Hi all,
I have 2 editable textfields on a screen (whilst testing). The first is editable and
accepts input from the user. The user is a concatenation of the authorised keys
pressed.
Code attached to text field one checks the keydown against a case statement, checks to
see that the key is a letter (using charToNum(the key)) and if so displays it and adds
it to the second text box (only for testing - won't be on screen eventually - probably
a variable).
It works perfectly for passing the correct keys to the 2nd field but not to itself.
e.g. press a or A and it will allow it (and capitalize it), display it AND pass it to
the second field.
BUT, enter a number or a symbol (",.@'#~) and, correctly, it doesn't pass it to the
2nd field BUT, incorrectly, does display it in itself.
I'm sure I'm doing something wrong. The code's below. Have I got something in the
wrong order or is there something to do with fields that I don't know?
------------------------CODE BEGINS--------------------------
property sNum
on beginsprite me
sNum = me.spritenum
set the text of sprite(sNum).member to ""
set the text of member "CurrentWord" to ""
end
on keyDown me
put chartonum(the key)
case (true) of:
(chartonum(the key) = 13):--RETURN
submitWord(me)
((chartonum(the key) > 64) AND (chartonum(the key) < 91)): -- A-Z
pKeycode = chartonum(the key)
charadder(me, pKeycode)
((chartonum(the key) > 96) AND (chartonum(the key) < 123)): -- a-z
capitalize (me, pKeycode)
pKeycode = the result
charadder(me, pKeycode)
otherwise:
pass
end case
end
on charAdder me, pKeycode
member("Entry").text = member("Entry").text & NumtoChar(pKeycode)
member("CurrentWord").text = member("CurrentWord").text & NumtoChar(pKeycode)
end
on capitalize me, pKeycode
UpperToReturn = pKeycode - 32
return UpperToReturn
end
------------------------CODE ENDS--------------------------
I believe I'm 'controlling' the input allowed through the CASE statement and the use
of OTHERWISE. Am I wrong?
TIA
Leon
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]