Re: [gtk-list] A dumb question about gtk_widget_destroy().



>  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 -+ 




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