Re: [gtk-list] destroying a window




On Sat, 11 Apr 1998, Michael Oswell wrote:
> Hi, I've looked through all the documentation and can't seem to find
> exactly what I'm looking for in regards to killing a dialog window.  If 
> I open up a main window, then open up a dialog over that, I want to
> just kill the dialog box without closing the whole application down.  If,
> 

Look in the tutorial, it's in there somewhere. You just want to destroy
the dialog.

If clicking `button' should destroy dialog `dialog', the easiest thing
is:

gtk_signal_connect_object( GTK_OBJECT(button), "clicked",
	                   GTK_SIGNAL_FUNC(gtk_widget_destroy),
	                   GTK_OBJECT(dialog) );

this saves you writing your own callback.

If you need the callback to do other things besides destroy:

gtk_signal_connect ( GTK_OBJECT(button), "clicked",
	             GTK_SIGNAL_FUNC(my_destroy), dialog );

void my_destroy ( GtkWidget * button, gpointer dialog )
{
 /* Do your other things, then: */
 gtk_widget_destroy(GTK_WIDGET(dialog));
}

Untested and from memory, but you get the idea. 

Havoc Pennington
http://pobox.com/~hp




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