Polling keyboard

:question:
If one wants that the hit of a key on the keyboard be detected by the program immediatly, without waiting for the carriage return, on Windows the problem can be solved by including <conio.h> and using the method _getch(). The problem by doing so is that the program is not transportable to unix. Anyway I do not know how to solve the problem on Unix.
Does Root offer such a possibility, in which case it would be transportable from Windows to Unix? Thanks for your answer.

Hi François-Xavier,
keyboard handling is done in
root.cern.ch/root/htmldoc/TRint. … eTermInput
which is using Getlinem (platform independent).
Gelinem is defined in clib/Getline.c and uses low level
(Win32 console functions) for key handling.

IMO, adding signals to TApplication class would help
void KeyPressed(UInt_t key); //SIGNAL
void ReturnPressed(const char *text ); //SIGNAL
void TabPressed(); //SIGNAL

It would be possible to connect KeyPressed signal
to yours handler.

Regards. Valeriy

Hi François-Xavier,
we added (in CVS) signals to TApplication class

virtual void Terminate(int status = 0); //SIGNAL
virtual void KeyPressed(int key); //SIGNAL
virtual void ReturnPressed(char *text ); //SIGNAL

Now, you can do keyboard polling via connection to some global function
gApplication->Connect(“KeyPressed(int)”,0,0,“key_handler(int)”);

HTH. Regards. Valeriy