R
Rainer
Hello everybody,
I have a question concerning wxRuby/wxWidgets. I'm getting my feet wet
with a simple application that holds one Wx::Frame called VwX.
When my application gets closed, I want the user to decide whether the
app really will shut down. If it shuts down: Save the last changes or
not? Typical Yes/No/Cancel situation. So I do this: (Remark:
VwXEvOnClose(event) is the "on_close" event of my Wx::Frame):
def VwXEvOnClose(event)
dlg = MessageDialog.new(nil, "Save changes?", "MyApp",
Wx::YES_DEFAULT|Wx::CANCEL|Wx::YES_NO|Wx::ICON_EXCLAMATION)
command = dlg.show_modal
dlg.destroy
case command
when Wx::ID_CANCEL
event.veto
when Wx::ID_YES
save_my_changes
event.skip
else
event.skip
end
end
This works as it is supposed to. However, I noticed that the call to
"event.veto" might just as well be missing without any problems. OTOH,
the calls to "event.skip" are essential: If I dont call these, the
application simply won't shut down. Any ideas why the veto is
unimportant?
I have a question concerning wxRuby/wxWidgets. I'm getting my feet wet
with a simple application that holds one Wx::Frame called VwX.
When my application gets closed, I want the user to decide whether the
app really will shut down. If it shuts down: Save the last changes or
not? Typical Yes/No/Cancel situation. So I do this: (Remark:
VwXEvOnClose(event) is the "on_close" event of my Wx::Frame):
def VwXEvOnClose(event)
dlg = MessageDialog.new(nil, "Save changes?", "MyApp",
Wx::YES_DEFAULT|Wx::CANCEL|Wx::YES_NO|Wx::ICON_EXCLAMATION)
command = dlg.show_modal
dlg.destroy
case command
when Wx::ID_CANCEL
event.veto
when Wx::ID_YES
save_my_changes
event.skip
else
event.skip
end
end
This works as it is supposed to. However, I noticed that the call to
"event.veto" might just as well be missing without any problems. OTOH,
the calls to "event.skip" are essential: If I dont call these, the
application simply won't shut down. Any ideas why the veto is
unimportant?