On 9/28/06, Sumedh <[EMAIL PROTECTED]> wrote: > > Gtk - C > > how to pass multiple arguments to a function from a widget. eg i have > two text entry widgets > > and one button. What i want to do is that when i click the button i > should be able to > > print(terminal) the contents of both the text entry widgets. Right now i > can print from only one > > widget. > > > > g_signal_connect accepts only 4 arguments. The last one is the data > pointer when i pass > > another data pointer as 5 arguments, gtk spits an error which says that > only 4 arguments > > are valid.
Here's how I'd do it: struct my_params { GtkEntry *e1, *e2; int my_other_param; } ... struct my_params mp; mp.e1 = ...; g_signal_connect(G_OBJECT(button), "clicked", callback, &mp); ... void callback(GtkButton *b, gpointer data) { struct my_params *mp = data; /* use mp->e1 and mp->e2 */ } _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list