Re: [gtk-list] callback parameters messed up



On Fri, 5 Mar 1999, Eric Bourque wrote:

> I've got a button callback which is consistently giving the gpointer
> data in the widget field, and vice versa. This is code that worked fine
> with 1.0.6, and I have just upgraded to 1.3.0. I have checked that I am
> setting things correctly using gdb, but the callback parameter list is
> consistently mixed up. Any ideas?


it helps if you tell us the signature of your callback and what signal
you try to connect to.
Gtk provides two possibilities (wrt the signature) to connect to a signal:

static void callback_clicked (GtkButton *button, gpointer data);

gtk_signal_connect (GTK_OBJECT (button), "clicked", callback_clicked, data);

or:

static void callback_clicked (gpointer data, GtkButton *button);

gtk_signal_connect_object (GTK_OBJECT (button), "clicked", callback_clicked, data);


the prototype of your callback needs to match your choice of gtk_signal_connect
vs. gtk_signal_connect_object. if the widget and data pointer seem to be
consistanly exchanged, you probably want to connect with the other functionm
variant.

> 
> Eric
> 

---
ciaoTJ



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