Re: Sending structures to callbacks



> From: Sven Neumann <sven gimp org>
>
> Delbert Martin <dmartin kionix com> writes:
>
> > I have Seen a lot of code on this but cannot get it to work on my program
> > here is a example
>
> your example can not work, try this one instead:
>
>   struct entries {
>  	GtkWidget *entry1;
>  	GtkWidget *entry2;
>   }
>  
>   struct entries str;
>
>   str.entry1 = gtk_entry_new();
>   str.entry2 = gtk_entry_new();
>  
>   gtk_signal_connect(GTK_OBJECT(object), "event",
>                      GTK_SIGNAL_FUNC(my_callback), &str)
>
>   ... [ the callback code was fine ]

You probably also want to add a reference to the entries
(which you are presumably adding to some widget) using
gtk_widget_ref() (or g_object_ref() if you're working with version 1.3/2.0)

Ron




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