Question
Question
(OP)
Hello,
Does anyone know the keyboard map for all the keys to use with the onkey command ? I tried to use the same onkey codes with qbasic as I used to use with gwbasic. I need the codes for the arrow keys (seperate pad not numeric keys). Can anyone help ?
Does anyone know the keyboard map for all the keys to use with the onkey command ? I tried to use the same onkey codes with qbasic as I used to use with gwbasic. I need the codes for the arrow keys (seperate pad not numeric keys). Can anyone help ?
RE: Question
RE: Question
***** P = down, H = up, K = left, M = right *****^
CODE
If k$ = Chr$(0) + "M" Then
rem right Arrow
rem ...
end if
If k$ = Chr$(0) + "K" Then
rem left arrow
rem ...
end if
If k$ = Chr$(0) + "H" Then
rem up arrow
rem ...
end if
If k$ = Chr$(0) + "P" Then
rem down arrow
rem ...
end if
SkyFighter
skyfighta@hotmail.com
Get the fun out of life!
RE: Question
Programmers,
OK, the qbasic.hlp helped a lot. Thank you. Now I have another problem when I continue to use the arrow keys I get an out of stack space error. How can I supress this ?
Here is the code:
' Findkey.bas used to find what key is pressed
DEFINT A-Z
CLS
start:
KEY(11) ON
KEY(12) ON
KEY(13) ON
KEY(14) ON
ON KEY(11) GOSUB a
ON KEY(12) GOSUB b
ON KEY(13) GOSUB c
ON KEY(14) GOSUB d
GOTO start
a:
PRINT "up"
GOTO start
b:
PRINT "left"
GOTO start
c:
PRINT "right"
GOTO start
d:
PRINT "down"
GOTO start
RE: Question
Lee
RE: Question
Lee
RE: Question
RE: Question
Rather than using on key, you might just capture the key and process it using inkey$ for example.
theloop:
a$=inkey$
if len(a$)=2 then gosub process.control.input:goto theloop
if a$=chr$(8) then 'backspace
.
.
end if
if a$=chr$(13) then '$CR
.
.
end if
process.control.input:
if left$(a$,1)=chr$(0) then
select case right$(a$,1)
case ...
end select
end if
return
RE: Question
CODE
DO
k$ = INKEY$
SELECT CASE k$
CASE CHR$(27)
PRINT "escape key"
INPUT "do you wanna exit (Y or N)", yn$
IF UCASE$(left$(yn$,1)) = "Y" THEN END
CASE CHR$(8)
PRINT "backspace key"
CASE CHR$(13)
PRINT "enter key"
CASE CHR$(0) + "P"
PRINT "down arrow"
CASE CHR$(0) + "H"
PRINT "up arrow"
CASE CHR$(0) + "K"
PRINT "left arrow"
CASE CHR$(0) + "M"
PRINT "right arrow"
END SELECT
LOOP
SkyFighter
skyfighta@hotmail.com
Get the fun out of life!
RE: Question
you might want to look at...
Thread314-709202
or
Thread314-431683
>> seperate pad not numeric keys
*Note: the keys are actually mapped the same... the only difference is the NumLock key status...
both sets of keys return the following ScanCodes:
72 - Up
75 - Left
77 - Right
80 - Down
Have Fun, Be Young... Code BASIC

-Josh
http://cubee.topcities.com
PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.