[10445] in The GTK GIMP ToolKit mailing list archive
[gtk-list] Re: A dumb question about gtk_widget_destroy().
daemon@ATHENA.MIT.EDU (David Given)
Wed Nov 25 12:58:46 1998
To: gtk-list@redhat.com
From: "David Given" <david_given@tao.co.uk>
In-reply-to: Your message of "Wed, 25 Nov 1998 11:24:51 EST."
<199811251624.LAA23520@avarice.astro.unc.edu>
Date: Wed, 25 Nov 1998 17:34:33 +0000
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com
> button = gtk_button_new_with_label ("close");
> gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
> GTK_SIGNAL_FUNC(gtk_widget_destroy),
> GTK_OBJECT (window));
>
>However, looking at gtkwidget.h, I see that gtk_widget_destroy() only has
>one argument, so the above piece of code should destroy the button
>itself, not the whole window. It does exactly that when I program it
>like this, but it works in testgtk.
From my understanding of the documentation (trans.: I've never done this
myself), gtk_signal_connect_object calls a signal handler with an object other
than the one that generated the signal. So when `button' receives a `clicked'
signal, the signal handler is called with `window' as the current object
instead of `button'. The last parameter above isn't the user data.
However, I don't know why it doesn't work in your code. Are you sure you're
using gtk_signal_connect_object and not gtk_signal_connect?
--
+- David Given ----------------+
| Work: dg@tao.co.uk | No good deed goes unpunished.
| Play: dgiven@iname.com |
+- http://wiredsoc.ml.org/~dg -+
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null