Re: [gtk-list] how to use gtk_object_class_user_signal_new



> Such as I want to create a signal with a parameter guint.
> 
> So what I did is:
> 
> //create new signal
> gtk_object_class_user_signal_new(klass,"user",GTK_RUN_FIRST,gtk_signal_default_marshaller,GTK_TYPE_NONE,1,GTK_TYPE_UINT);
> 	... ...
> 
> //in somewhere of my code, I setup callback
> gtk_signal_connect(GTK_OBJECT(widget),"user",GTK_SIGNAL_FUNC(User_Process),NULL); 
> 
> //in somewhere of my code, I declare the call back function defination
> void User_Process(GtkWidget *widget, guint *type,gpointer data)
> {
>      ....
> }

Two things:
	- `type' should be a guint, not a guint*.
	- use gtk_marthal_NONE__UINT instead of gtk_signal_default_marshaller,
	  which is a #define to gtk_marshal_NONE__NONE...
If you are getting your signal then all else should be well.


> 
> //in somewhere, I sent out the signal:
> m=5;
> gtk_signal_emit_by_name(GTK_OBJECT(widget),"user",&m);
> 
> 
> But what happened is:
> the signal is successfully being sent and the call back function is
> being called, but the m never passed to the call back function, which
> means type=NULL.  So I wonder how I can pass the parameter of the signal
> to the call back function
> 



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