Can't capture key events

In the following example code, there is no response to pressing any key.
The mouse button does produce the desired result:

require ‘rubygems’
require ‘wx’

class EventFrame < Wx::Frame
def initialize()
super(nil, -1, “Event Frame”)
panel = Wx::Panel.new(self)
panel.evt_left_down {|event| puts “Left mouse key clicked”}
panel.evt_key_down{|event| puts “Key clicked”}
show()
end
end

class MyApp < Wx::App
def on_init
EventFrame.new()
end
end

MyApp.new.main_loop

This is wxruby 2.0.1 on Ubuntu 9.10. I have also tried evt_key_up and
evt_char.

Any ideas?

Thanks,
Chris

Chris W. wrote:

In the following example code, there is no response to pressing any key.

I found an answer. It works if I specifically give the panel focus
(panel.set_focus).