09-17-2024, 05:41 PM
I was playing around with seeing which keys are seen when focus is lost and regained. _KEYDOWN does see some of them, but the SHIFT keys are not.
Here's a quick hack of some code I made to investigate.
Here's a quick hack of some code I made to investigate.
Code: (Select All)
'Quick hack
LOCATE 8, 2
PRINT "NOTE: _KEYDOWN only registers SHIFT keys and some of the other keyboard keys"
PRINT " _KEYDOWN will register multiple keys"
PRINT " A negative _KEYHIT value means the key was released"
DO
LOCATE 2, 2
IF _WINDOWHASFOCUS THEN
'IF focus = 0 THEN _KEYCLEAR
focus = -1
PRINT "WINDOW HAS FOCUS "
ELSE
focus = 0
PRINT "WINDOW DOES NOT HAVE FOCUS"
END IF
a$ = INKEY$
LOCATE 4, 2
PRINT "INKEY$ = "; a$
LOCATE 5, 2
PRINT "_KEYHIT = ";
k = _KEYHIT
IF k <> 0 THEN PRINT k; " "
LOCATE 6, 2
PRINT "_KEYDOWN = ";
IF _KEYDOWN(100304) AND _KEYDOWN(100303) THEN
PRINT "LEFT & RIGHT SHIFT"
ELSEIF _KEYDOWN(100304) THEN
PRINT "LEFT SHIFT "
ELSEIF _KEYDOWN(100303) THEN
PRINT "RIGHT SHIFT "
ELSE
FOR k = 33 TO 122
IF _KEYDOWN(k) THEN
PRINT CHR$(k); " "; ' print multiple keys
END IF
NEXT k
PRINT " "
END IF
_LIMIT 60
LOOP UNTIL _KEYDOWN(27)