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

Vladimir Konrad
Fri, 11 Jan 2008 17:34:17 -0000

> 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...