This is essentially a C question. How would I detect
a shift+left arrow and shift+right arrow keyboard input?
Thank you,
Shashank
This is essentially a C question. How would I detect
a shift+left arrow and shift+right arrow keyboard input?
Thank you,
Shashank
Shashank <sbalijepalli@precitech.com> wrote:
This is essentially a C question. How would I detect
a shift+left arrow and shift+right arrow keyboard input?
It depends on where you get keyboard input from. The C language itself
doesn’t have a concept of the Shift key or the arrow keys…
If you’re reading keys from Photon, there’s a flag in the key event that
tells you the state of the Shift key.
If you’re reading keys from a text-mode terminal, it might simply be
impossible. Most teminals send exactly the same sequence of characters
for a shifted and unshifted arrow key, and don’t send anything when a
shift key is going up or down. In particular, this applies to both QNX
terminal protocols.
On a QNX4 text-mode console (but not in a pterm), you could use the
“scan mode” or the “extended mode” to keep track of the shift keys, but
that affects a lot more than just the shift keys (see console_ctrl() in
the docs).