Re: Notebook and listbox problems.




Owen Taylor writes:
>If you call gtk_signal_connect, then on a callback, widget is
>set to the object to which you are connecting the object, and
>data is whatever you specify as the fourth argument.
>(That's why the first try with gtk_signal_connect destroyed
>the button.)
>
>If you call gtk_signal_connect_object, then regardless of the
>object you are connecting to, the widget argument to the callback
>is set to the _fourth_ argument of gtk_signal_connect_object.

Hmm.  Then if I change the gtk_signal_connect_object in simple.c
to a gtk_signal_connect, it should only get rid of the button,
not the whole window, right?  Or do I misunderstand?

I changed simple.c so that
  gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
                             GTK_SIGNAL_FUNC (gtk_widget_destroy),
                             GTK_OBJECT (window));
became
  gtk_signal_connect (GTK_OBJECT (button), "clicked",
                      GTK_SIGNAL_FUNC (gtk_widget_destroy),
                      GTK_OBJECT (window));
and the behavior of the program stayed exactly the same.

I added a second button in a vbox, so that there would be something
left in the window after the button was destroyed in case the window
was closing down because it had no contents, but that had no effect
on this behavior.

Now, when I add two buttons, and want to destroy one of them by
clicking the other, it only works if I use gtk_signal_connect_object,
as expected.  If I only use gtk_signal_connect, I destroy the button
clicked instead of the "target" button.  So I really don't understand
why the changes to the original version with one button didn't have
the effect I expected...

Could someone elucidate?

Thanks!

michaelkjohnson

"Ever wonder why the SAME PEOPLE make up ALL the conspiracy theories?"




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