The KEY SHIFT
function returns the current status of the various
control keys. These keys such as SHIFT
or ALT
cannot be
detected using the standard INKEY$
or SCANCODE
functions.
But you can easily test for any combination of control keys with
just a single call to the KEY SHIFT
function. The result is a
bit map with the following meaning:
0 -LEFT SHIFT
1 - RIGHT SHIFT
2 - CAPS LOCK
3 - CTRL
4 - LEFT ALT
'5 - RIGHT ALT
If a bit is set to a one, then the associated button has been held
down by the user.
Note that not all computers support control keys, nor is it possible
to have individual pressure detection. Depending on the target,
some of the bits may not be available, or only under certain
conditions.
= KEY SHIFT
CENTER "Press some control keys" DO LOCATE 14, 4 PRINT BIN$(KEY SHIFT, 8) LOOP
Join BASIC 10Liner Contest with ugBASIC!
An interesting competition is held at the beginning of each year: the
BASIC 10Liner Contest.
It is possible to use ugBASIC to participate in the next
"BASIC10Liner" competition, in the following categories:
KEY SHIFT ↔ KySHIFT
If you have found a problem with this keyword, if you think there is a bug or, more
simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!
open an issue
BACK TO KEYWORDS