[wxruby-users] key press event

Brad Montgomery
Tue, 16 Jun 2009 10:29:19 -0000

Dimas Cyriaco wrote:
> Brad, your code worked fine for me.
>
> Just added:
> require ''rubygems''
> require ''wx''
> before include Wx
>
> and changed { |ev| puts ''a key was pressed'' }
> to { |ev| message_box(''a key was pressed'') }
> just to make it easier to see the results

Dimas thanks for the reply

I neglected to put those lines in my post but they are in the code

what OS are you using, ruby version, & wxruby version ?

I got the code to work if I connected the event handler to a Wx::Panel,
but that will not solve the problem.
When the event handler is connected to the panel and the user touches
another
widget on the screen that widget will now have focus and the panel will
no
longer receive the key press events.

I need the event handler connected to the Frame/Window and listen for
event
even if it does not have focus.
I am reading from a bar code scanner that sends the data as keyboard
input.

thanks & happy coding
  brad