Re: newbie: on the form of callbacks...



The argument that you pass through gtk_signal_connect() is the "data"
argument to the callback.  The other argument ("widget") is
automatically passed by GTK.  This is true of all the callback
prototypes.

Cevat Ustun wrote:

Below are two snippets taken from the "Upgraded hello world"
example in the tutorials. My question is:  the function
"callback" is called with _one_ argument; a pointer to "button 1",
whereas the callback function itself has _two_ arguments...
What's going on?

gtk_signal_connect (GTK_OBJECT (button), "clicked",
                    GTK_SIGNAL_FUNC (callback),
                    (gpointer) "button 1");

void callback( GtkWidget *widget,
               gpointer   data )
{
g_print ("Hello again - %s was pressed\n", (char *) data);
}

Thanks for any help,

Cevat Ustun

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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