[fxruby-users] Handling Escape key-press in dialog window

Vladimir Konrad v.konrad at lse.ac.uk
Fri Jan 11 12:34:17 EST 2008


> See what happens if you do something like this:
> 
> 	self.connect(SEL_KEYPRESS) do |sender, sel, event|
> 		app.exit(0) if event.code == KEY_Escape
> 		false
> 	end

This was my first approach (and it still does the same - carries on.

The self.connect(SEL_KEYPRESS) does not get even called (is this
because some other widget has a focus (there are other keyboard
handlers in the log-in screen, but they are set-up for KEY_RELEASE)?

Also, the log-in dialog box gets created in the main window .create
method:

# Main window .create method

  def create
    super
    LoginWindow.new(self).execute(PLACEMENT_SCREEN)
    show(PLACEMENT_SCREEN)
  end

Vlad

PS: I bought your book, time permitting I will send some feed-back...

Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm


More information about the fxruby-users mailing list