[Gtk-sharp-list] Close button and "Really Quit" dialog?

Matthew Pirocchi matthew.pirocchi at gmail.com
Mon Feb 8 12:53:22 EST 2010


Hi Ian,

You want to use the "DeleteEvent" event:

window.DeleteEvent += delegate (object o, DeleteEventArgs args) {
// Do something
args.RetVal = trueOrFalse; // false if you still want to close the window,
true if you want to keep it open
};

-Matthew

On Mon, Feb 8, 2010 at 12:17 PM, Ian Finlayson <finlaysoni at gmail.com> wrote:

> Hello,
>
> I am writing a GTK# application and would like to prevent users from
> quitting without saving their work.  If they select the "Quit" option
> from the menu, I give them a dialog box offering to save, cancel or
> quit without saving.  This works well, but I can't figure out how to
> make it happen if they click on the close button on the upper right of
> the window.  I tried handling the "Destroyed" event, but it is getting
> called after the window has closed, so there's no way for them to
> cancel the quit.  Is there some way to do this?
>
> On a related note, is their a standard dialog for this kind of
> question?  Because most Gnome applications seem to use the same
> dialog, but I couldn't find any info on it.  For now I am just using
> my own, but it looks a little different and standards are always good.
>
> Thanks for your time!
>  - Ian
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20100208/0f68e8cf/attachment.html 


More information about the Gtk-sharp-list mailing list