Re: Using data parameter for callback functions



Gee, it works, but I dont quite get why the generic approach doesn't
supply the correct data address. I haven't found a note anywhere indicating that I have to use the specific 
event handler for some
 widget. Good thing to know anyhow, big thx.

- Malek

On Sun, 25 Jan 2004 18:25:36 +0000
Tim Müller <zen18864 zen co uk> wrote:

You have to check the API reference to see what the callback function for a 
signal needs to look like:

  http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidget-button-press-event

In your case, the callback needs to be

static gboolean
cancel_button_pressed (GtkWidget *w, GdkEventButton *bevent, gpointer data)
{
    gtk_widget_hide(GTK_WIDGET(data));
   ....
}

Also check out the Gtk+ Tutorial, esp. section 3.4:
 
   http://www.gtk.org/tutorial/
   http://www.gtk.org/tutorial/sec-events.html


Cheers
-Tim


_______________________________________________
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]