Re: [gtk-list] Passing two arguments via gtk_signal_connect?



On Wed, 22 Sep 1999, jay wrote:
> Excuse me if this is a bit vague, but I'll explain it the best I can.
> 
> I'm trying to have a color selection dialog pop up when a drawing area is
> clicked, and then the color changes are reflected in an entry beside the
> drawing area.  To do this, I have to pass both the entry, and the
> colorselection widget to the function that is called when the color is
Make a struct with those widgets inside. For example :
typedef struct 
{
GtkWidget * colorsel;
GtkWidget * entry;
}color_entry;

> changed. (the entry so it knows which entry to change, and the colorsel
> widget because the function obviously needs it)
> I'm connecting a signal to the color selection dialog via
> gtk_signal_connect(), and this only allows one argument. (the only
> downside i've found with gtk)

Make an object:
color_entry *colorentry_object;
And than for example if a button was clicked:
gtk_signal_connect (GTK_OBJECT (button), "clicked",
		      GTK_SIGNAL_FUNC (function_name), colorentry_object);

> Any suggestions on how I can write a workaround for this?  It's really
> getting under my skin. :))
> 
> Thanks for any help..

Hope this helps

Andreas Scherf
- "If you kiss me, I'll turn into a beautiful princess."
- "Look, I'm a computer programmer. I dont have time for girls,
but a talking frog is very very cool."
+--------------------------------------------+
I EMail    : scherfa@fh-trier.de             I  
I Homepage : http://www.fh-trier.de/~scherfa I
+--------------------------------------------+



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