Re: Newbie still with probs...



How can I pass more than one argument to the gtk_signal_connect function, I
mean:
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(showname),
label1, label2, button1);
do u understand? I do not know if this is correct? I know I can do the
following:
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(showname),
label1);
but is it ok the first version??

No, the first version is wrong, you can only pass ONE parameter 
to the callback function. That's why you have to pass a pointer
to a structure or use set_data/get_data. This is not a problem
at all, as your structure can have as many variables as you wish,
and you can use as many set_data/get_data as you wish.

for example:

typedef struct _my_struct {
variable A;
variable B;
variable C;
variable D;
variable E;
variable F;
etc...
} my_struct;

my_struct *label1;

gtk_signal_connect(GTK_OBJECT(button), "clicked", 
GTK_SIGNAL_FUNC(showname), label1);

Carlos




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