[Fxruby-users] Re: FX Ruby question
Status: Inactive
Brought to you by:
lyle
|
From: Lyle J. <ly...@kn...> - 2004-03-07 23:46:33
|
On Mar 7, 2004, at 12:36 PM, John Reed wrote:
> I don=92t know how to capture the SEL_CLOSE event in my program =
because=20
> if the dialog box used in the program for data entry is open, and=20
> there have been changes, I want to warn the user about those changes.=20=
> I tried attaching the .connect(SEL_CLOSE) to the contents object, but=20=
> that didn=92t work.
No, there's no point in connecting SEL_CLOSE on the "contents" object=20
since it's a vertical frame and not an FXMainWindow. I *started* to say=20=
that this shouldn't be a big deal, because if you display the dialog=20
box modally, the user wouldn't be able to click the main window's close=20=
button. But I just ran a quick test and it doesn't appear that modality=20=
of a dialog box prevents you from closing the application's main window=20=
(this was a surprise to me).
So another option to consider is to save a reference to the dialog box=20=
when you construct it, e.g.
@theDataEntryDialog =3D FXDialogBox.new(...)
and then check to see if it's still shown in your SEL_CLOSE handler for=20=
the main window:
theMainWindow.connect(SEL_CLOSE) {
... if @theDataEntryDialog.shown? then don't close yet =
...
}
Why don't you see if that does the trick? If not, we'll take another=20
look.
Hope this helps,
Lyle
|