[Gtk-sharp-list] prevent window from closing

Franz Burgmann franz.burgmann@web.de
Wed, 31 Dec 2003 13:44:22 +0100


Franz Burgmann schrieb:

> Martin Willemoes Hansen schrieb:
>
>> On Wed, 2003-12-31 at 12:10, Franz Burgmann wrote:
>>  
>>
>>> hi,
>>>
>>> a question: when I'm pressing the delete-button of a window it is 
>>> going to be hidden.
>>> How can I get it back or how can I prevent the window from 
>>> disappearing (like do_nothing_on_close)?
>>>
>>> The reason is, I wan't to put a confirm-dialog before the window is 
>>> going to close.
>>>   
>>
>>
>>
>> I do something like this, when I want confirmation before closing my
>> app:
>>
>> [Glade.Widget] Dialog quit;
>> void Quit (object sender, EventArgs args)
>> {
>>        XML dialog = new XML (null, "glade/gui.glade", "quit", null);
>>        dialog.Autoconnect (this);
>>            switch (quit.Run()) {
>>                case (int)ResponseType.Yes:
>>                Content.Save();
>>                     Application.Quit();
>>                        break;
>>                case (int)ResponseType.No:
>>                        Application.Quit();
>>                        break;
>>                }
>>                                                                                    
>> quit.Destroy();
>>                                                                       
>>        DeleteEventArgs deargs = args as DeleteEventArgs;
>>        if (deargs != null)
>>                deargs.RetVal = true;
>> }
>>
>> 1. Put up a dialog, to check if the user rely wants to quit or wants
>> to quit and save his work.
>> 2. If the app is closed with a DeleteEvent, then set RetVal to true so
>>   that the windowmanager does not close down the main window
>>
>>
>>  
>>
>>> franz
>>>
>>> _______________________________________________
>>> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>>>   
>>
>>
> hm,
>
> you're making your app with glade. For the moment I don't see how to 
> use this in my self made window.


After a second look at your code, Martin, I found what I was searching 
for. Thank you!!

franz