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
on 2010-02-25 22:20
on 2010-02-25 22:53
Chris Williams 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).
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.