Re: Still Problem with getKey
[Prev][Next][Index][Thread]
>I don=B4t think that=B4s the problem.
>By setting 0->K before checking getKey->K, I thought
>my nightmares would be over, but nope!
>What could be the problem if getKey always gives 105, except when another
>key is pressed?
>Could the Enterkey be jammed or could the problem be in ROM or somewhere
>else???=20
>Or should I just I just tell my friend to buy a new one ;-)
You have the right idea, but need to go one step farther. In addition to
storing 0 in K, you also need to put in a :getKey line after 0->K. this will
reintialize the getkey command to look for a new key press. If you don't
have this command, the enter key does appear to be stuck. This is because
when a key is pressed, the number is stored somewhere in memory until it is
recalled by getKey. By putting a :getKey command before your getkey loop,
you recall the last key pressed (which could have been some time ago), and
clear that space to read the next key. Of course, when I say "the last key
pressed", that is not entirely true. If getKey is clear and you press a key,
that number will be stored in memory. But if you press another key, that
number is NOT stored in memory as long as getkey is already defined. So what
I should actually say is "the first key pressed after the last getKey
executed". Here is a sample code:
0->K
getKey
While K=0
getKey->K
End
Or, if you do not care what key was pressed (any key continues):
getKey
While getKey=0
End
All previously posted methods *will not* work. You must have the :getKey
command to clear the memory.
-Brian Hill
References: