Forum: FXRuby Not receiving FXTopWindow events

Posted by Leslie Viljoen (leslieviljoen)
on 2009-11-11 18:35
I am trying to listen for the FXTopWindow events SEL_CLOSE,
SEL_MINIMIZE, SEL_MAXIMIZE, SEL_RESTORE because I want to execute some
code when a person presses the X button to close the window, etc.

None of my code gets executed though. Can anyone help?

class TextDialog
  def initialize(parent)
    construct_widget_tree(parent)
    init if respond_to? 'init'
  end

  def construct_widget_tree(parent)
    @topwin = FXMainWindow.new(parent, 'title')
    @topwin.width = 300
    @topwin.height = 200
  end

  attr_reader :topwin
end

if __FILE__==$0
  require 'fox16'
  include Fox

  app=FXApp.new
  w=TextDialog.new(app)

  w.topwin.connect(SEL_CLOSE) { app.exit }
  w.topwin.connect(SEL_MINIMIZE) { puts "MIN" }
  w.topwin.connect(SEL_MAXIMIZE) { puts "MAX" }
  w.topwin.connect(SEL_RESTORE) { puts "RESTORE" }

  w.topwin.show
  app.create
  app.run
end
Posted by Leslie Viljoen (leslieviljoen)
on 2009-11-11 21:17
This forum looks dead so I am cross-posting to:
http://rubyforge.org/pipermail/fxruby-users/2009-November/date.html

I apologize for that.
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
No account? Register here.