Re: [gtk-list] Re: Don't know why this does not work.



Mikael Grahn <nvx@hem.passagen.se> writes: 
> void hello(GtkWidget *widget, GdkEvent *event, gpointer data)
> 
> isn't right for a callback... 
> 
> void hello(GtkWidget *widget, gpointer data)
> 
> It should look like this.I only use the upper one when handling
> delete_event. I'm quite new with gtk also, so i can't really explain why.

The reason is that the signature of a callback always depends on the
specific signal being emitted, so you always have to check the docs or
header files to see which signature you need.

A very common signature is:
 void hello(GtkWidget *widget, gpointer data)

And all the "event" signals use:
 gint event_cb(GtkWidget* widget, GdkEvent* event, gpointer data)

where the return value controls propagation of the event to parent
containers.

Read my book on this, http://developer.gnome.org/doc/GGAD/ it has full
details.

Havoc



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