[wxruby-users] lose focus event?

David Morton
Sun, 20 Jan 2008 00:40:05 -0000

On Jan 19, 2008, at 6:22 PM, Mario Steele wrote:

> evt_focus does capture all focus changes.  The thing to do, is
> utilize EvtFocus.get_window, that will return the window that the
> focus is being called for.

test.rb:63:in `on_init'': undefined method
''get_window'' for
#<Wx::FocusEvent:0x11d26a98> (NoMethodError)
         from test.rb:68:in `call''
         from test.rb:68:in `main_loop''
         from test.rb:68


class HelloWorld < App
    def on_init
      helloframe = Frame.new(nil, -1, "Hello World")

      button = Button.new(helloframe, :label => ''Close'',
:pos =>
[200,200])
      evt_button(button) {exit}
      cbo = MyComboBox.new(helloframe,
                         :pos =>Point.new(10,10),
                         :choices => ["foo","bar"],
                         :value => "asdasd",
                         :style => CB_SORT)
      helloframe.show()
     evt_set_focus() {|w|
        puts w.get_window
        # how do I tie this to cbo ?
     }
    end
  end
  HelloWorld.new.main_loop





David Morton
Maia Mailguard http://www.maiamailguard.com
mortonda at dgrmm.net



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iD8DBQFHkphlUy30ODPkzl0RAmhIAJ4oTI9fQSCMlotalaYNvNa1EXvkTQCgkdVf
CgiQBdFCoEdUE1ZU6bC1Deo=8NQI