Re: Problem: hiding window



On Saturday 15 April 2006 05:21, Deependra Shekhawat wrote:
Hello friends,

I want to hide a window when user clicks either on the
close button or press the close (CROSS) on the
top-right of every window.
Here is my code:

GtkWidget *window1;
GtkWidget *butt_close;

g_signal_connect((gpointer)butt_close,"clicked",
G_CALLBACK (on_butt_close_clicked),   (gpointer)
window1);

g_signal_connect ((gpointer) window1, "destroy",
          G_CALLBACK (on_butt_close_clicked), (gpointer)
window1);

void on_butt_close_clicked(GtkButton *button,gpointer
user_data)
{
   gtk_widget_hide((GtkWidget *)user_data);
}

The window hides up when I click the close button but
when I try and hide it through clicking the close
button on the top right of the window it gives the
following error:

[snip]

You cannot call gtk_widget_hide() on a widget when it is destroyed (its 
GdkWindow has gone).  You probably meant to connect to the delete-event 
signal.  That is what is emitted when you click the top right button you 
refer to.

Chris




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