Re: Passing Data to Callbacks



Hi,

on Fri, 1 Feb 2002 08:59:24 +0000
Adam Tee <eenajt electeng leeds ac uk> wrote:
Here is the connect object function that I'm using and the callback
function.

gtk_signal_connect(GTK_OBJECT(menu_item3), "activate",
                         GTK_SIGNAL_FUNC(unhighlight),
                         (struct scoreinfo *)si);
/* callback */
void
unhighlight (gpointer callback_data,GtkWidget * widget)
                     ^                    ^
Assuming that menu_item3 widget was created with gtk_menu_item_new*,
the callback function for "activate", as documented in GTK+ API
reference) is

void user_function (GtkMenuItem *menuitem, gpointer data).
                        ^                      ^
You just inverted the arguments. I think the way you wrote it, is suited
for gtk_signal_connect_object, for which the user data and the widget
pointer are inversed with respect to gtk_signal_connect.

HTH.

-- 
Melvin Hadasht



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