Last active
August 29, 2015 13:57
-
-
Save jameshibbard/9661116 to your computer and use it in GitHub Desktop.
FXRuby - capture close on the main window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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