[Gtk-sharp-list] How do I keep main window from closing?

Chris Howie cdhowie at gmail.com
Tue Jul 21 13:51:55 EDT 2009


I did some testing on this and determined the following:

* [GLib.ConnectBefore] is not necessary to disallow closing of the window.

* In order to properly continue with destruction of the window, do this:

args.RetVal = false;
Application.Quit();

* In order to disallow closing of the window, do this:

args.RetVal = true;
// Do *not* call Application.Quit()

On Tue, Jul 21, 2009 at 1:41 PM, bdubu<bwb at fireflysoftware.com> wrote:
>
>
>
> Jiří Zárevúcky wrote:
>>
>> Your problem is that RetVal set to true prevents closing, not the
>> other way around. When you leave the default false, it will close as
>> normally.
>>
>
> Thanks for responding.  That's weird.  Prior to my fiddling around with the
> OnDeleteEvent handler, a.RetVal was being set to true (and of course, the
> window was closing normally).  At this point I've tried setting it both to
> true and to false and neither way seems to help -- the window still closes.
> : (   Would my running under monodevelop be inhibiting the desired behaviour
> perhaps?  I've noticed that if I set a.RetVal to false, run my program and
> then close it, in monodevelop the "Debug" (run) toolbar button remains
> disabled and I have to shut down monodevelop to make this toolbar button
> re-enable.  Is this telling me something but I'm just too dense to get it?
> Also, if I'm supposed to set a.RetVal a particular way in order to cause the
> window to stay open, I assume that I shouldn't be calling Application.Quit,
> or should I?  Thanks!
>
>
> --
> View this message in context: http://www.nabble.com/How-do-I-keep-main-window-from-closing--tp24578770p24592149.html
> Sent from the Mono - Gtk# mailing list archive at Nabble.com.
>
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>



-- 
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers


More information about the Gtk-sharp-list mailing list