Re: [gtk-list] Re: multiple arguments to callback function



Cigaes wrote:
> 
> Aaron Walker, dans le message (.gtk.general:269), a écrit :
> > but, obviously, this did not work.  Is there a way to pass multiple
> > arguments to a callback or would I go about doing this a different way?
> 
> You can pass only one pointer. I see two solutions:
> 
> GtkText **multi_callback;
> multi_callback=g_new(GtkText *,3);
> multi_callback[0]=...
> multi_callback[1]=...
> multi_callback[2]=...
> gtk_signal_connect(...,multi_callback);
> 
> Or:
> 
> gtk_object_set_data(GTK_OBJECT(button),"first_text_widget",...);
> gtk_object_set_data(GTK_OBJECT(button),"second_text_widget",...);
> gtk_object_set_data(GTK_OBJECT(button),"third_text_widget",...);
> 

And a third would be to use a struct containing the 3 entries,

typedef struct AllEntries
{
  GtkWidget *entry1;
  GtkWidget *entry2;
  GtkWidget *entry3;
};

AllEntries *entries;

entries->entry1, entries->entry2, entries->entry3 to access them from
the the single pointer.

		Stephen



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