Forum > Unix
Crt.KeyPressed() on Linux: getting scancodes
(1/1)
MarkMLl:
If a console (non-GUI) program is running in a shell window on e.g. KDE on Linux (e.g. Debian 12), does it have any chance of recovering the scancode when e.g. the <F1> key is pressed?
The documentation for ReadKey() says that
--- Quote ---If an extended or function key has been pressed, then the zero ASCII code is returned. You can then read the scan code of the key with a second ReadKey call.
--- End quote ---
but I suspect that this might only apply to the system console, or that it requires the keyboard to be set to raw mode which the Crt overview explicitly says is a problem.
Application is a Telnet client with comprehensive hooks for Telnet options and NVT controls. However I'd emphasise that this is test code and not at all important: I'm asking more for curiosity than anything else.
MarkMLl
MarkMLl:
Please ignore this. I was, without thinking things through, expecting function keys etc. to work while debugging using the IDE: and that's quite simply a non-starter due to the limitations of input in the console window.
It is possible to set breakpoints to intercept extended codes (i.e. 0x00 followed by a scancode) if a program is started from a shell and the IDE/debugger is then attached to it using the Run -> Attach to program... facility. There might however still be certain keys that appear dead, which is almost certainly down to the configuration of the desktop environment; also some non-ANSI keys might have a prefix depending on the codepage and widget set.
MarkMLl
Navigation
[0] Message Index