How to set exit on close?

I want to set close window when press ‘X’ in top-right I make wxruby GUI
from Farpy guie but I can’t close it (when I close I must press close in
cmd and the return -1) how can I set it??

Pat K. wrote:

I want to set close window when press ‘X’ in top-right I make wxruby GUI
from Farpy guie but I can’t close it (when I close I must press close in
cmd and the return -1) how can I set it??
I’m not sure I understand your question. Basically, if you want to have
the standard close button close a window, do nothing. By default, wxRuby
understands that the “X” button should close the window.

If you want to do some custom checking or processing when the close
button on frame is pressed, use evt_close to define an event handler for
the frame.

evt_close :on_close

Then in your on_close method, receive the event, then either call skip()
or veto() to allow or disallow the event.

def on_close(event)
if ready_to_close
event.skip()
else
event.veto()
end
end

Take a look at the samples/minimal/minimal.rb as this is demonstrated in
there

alex

thank you I find it :slight_smile: