Using the arrow keys with Key On?
Posted: Mon Oct 17, 2005 5:36 am
Hey all! This looks like a great board. kudos on being one of the more lively QB communities.
My question is, how do you trap the cursor keys for use with the KEY (N) statement? I've found out how to do the Numeric Keypad arrow keys, like 8/up and 6/right, etc. But is there any way to do this with the cursor keys themselves?
My guess would be this:
KEY 15, CHR$(0) + CHR$(35)
KEY 15 ON
10
ON KEY(15) Gosub UpArrow
GOTO 10
UpArrow:
print "UP"
end
However, this doesn't work. I used 35 for the letter H, because when you do an inkey$ loop, I've always seen the up arrow key used like this:
if inkey$ = chr$(0) + "H" then Gosub UpArrow.
So I figured this would also work with KEY statements, but no dice. Anyone have any suggestions?
Thanks in advance,
Stevo
My question is, how do you trap the cursor keys for use with the KEY (N) statement? I've found out how to do the Numeric Keypad arrow keys, like 8/up and 6/right, etc. But is there any way to do this with the cursor keys themselves?
My guess would be this:
KEY 15, CHR$(0) + CHR$(35)
KEY 15 ON
10
ON KEY(15) Gosub UpArrow
GOTO 10
UpArrow:
print "UP"
end
However, this doesn't work. I used 35 for the letter H, because when you do an inkey$ loop, I've always seen the up arrow key used like this:
if inkey$ = chr$(0) + "H" then Gosub UpArrow.
So I figured this would also work with KEY statements, but no dice. Anyone have any suggestions?
Thanks in advance,
Stevo