[REBOL] Re: kbhit()
From: arolls:bigpond:au at: 24-Jun-2001 1:27
> DT> kbhit: func [][
> DT> con: open/direct/binary/no-wait console://
> DT> until [wait con]
> DT> choice: to-char pick con 1
> DT> ]
>
> This looks better:
>
> >> kbhit: does [to-string read/binary/wait console://]
> >> kbhit
> == "x" ; pressed x
> >> kbhit
> == "^[[A" ; pressed up arrow
>
> To Holger: will this have problems in the future?
It has problems now! :)
In latest Rebol/View 1.2.1, 'read has no refinement "/wait".
I modified it like this:
kbhit: does [to-string read/binary/part console:// 1]
which works a little bit strange with arrow keys etc:
>> kbhit
== "^["
>> [A ; pressed up arrow
but works ok for other keys:
>> ch: kbhit
== "d" ; pressed "d" key
Anton.