Michael Fellinger wrote:

>> Thanks manveru - could you tell me what keyboard.rb does in a nutshell.
>> I simply bind keys using the "?\C-a" kind of notation to symbols or
>> procs.
> 
> It allows me to make any object the receiver of keystrokes, simply by 
> doing
> Keyboard.focus = something
> the object has to respond to the #key method and take the name of the
> key (as string) as argument.
> So, in my code, once i show or hide a window/pane/view that is
> interactive, i simply let it take over the focus of Keyboard and don't
> have separate dispatching or some kind of main loop.

manver, i've been pouring through your code, and even tried out ver!

Then for kicks, i linked only keyboard.rb to a sample program and with 
only a couple lines added it worked. Prints out the control keys and ESC 
key combos.
It even gets Esc-a and Esc-A separately - wonderful. (it did hang when 
ESC was pressed twice).

However, it does not accept/print the Alt-keys - is that deliberate, or 
did have you not looked into it.

I have had problems with alt-keys (since they generate 2 bytes and that 
goes thru my getch() loop twice, often leaving an extra char in the edit 
field.
-- 
Posted via http://www.ruby-forum.com/.