Re: close -> destroy

On Sun, 23 May 1999, Miguel de Icaza wrote:

> > I create a nice dialog with ok and cancel button and present it to 
> > the user, now he press not ok nor cancel, but the close button of the WM, 
> > and --> boom ! my widget is destroyed, not hide nor anything else, 
> > destroyed.
> > 
> > What is the normal workaround to this ?
> There are a number of ways of doing this.
> The first one is to connect to the "delete_delete" signal on the toplevel
> window of the dialog box, and return FALSE if you do not want to
> accept window manager's close request.  Although, you should.

hey miguel,
probably a thinko, but need to correct you anyways ;)
you need to connect to the ::delete_event signal and return TRUE,
so gtk figurs the event has been handled and doesn't do its default
action, which is destroying the widget.
some pretty easy way to do that is:

gtk_signal_connect (GTK_OBJECT (window), "delete_event",
                    GTK_SIGNAL_FUNC (gtk_true), NULL);

> Best wishes,
> Miguel.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]