Skip to content

Instantly share code, notes, and snippets.

@jameshibbard
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jameshibbard/9661116 to your computer and use it in GitHub Desktop.
Save jameshibbard/9661116 to your computer and use it in GitHub Desktop.
FXRuby - capture close on the main window
require 'fox16'
include Fox
class MyApp < FXMainWindow
def initialize(app)
@app = app
super(app, "Test", :height => 150, :width => 350, :opts=> DECOR_ALL)
self.connect(SEL_CLOSE, method(:on_close))
end
def create
super
show(PLACEMENT_SCREEN)
end
def on_close(sender, sel, event)
q = FXMessageBox.question(@app, MBOX_YES_NO, "Sure?", "You sure?")
if q == MBOX_CLICKED_YES
return 0
end
end
end
FXApp.new do |app|
MyApp.new(app)
app.create
app.run
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment