Re: Still an error in passing structure in argument to CallBack function



On Sun, 6 May 2001, D Reymond wrote:

gboolean CallBackRedraw(GtkWidget *zone_dessin, GdkEventExpose *ev,  gpointer data )
                                                  ^^^^^^^^^^^^^^

I think (not at all certain) that this should be

gint CallBackRedraw(GtkWidget *, GdkEventExpose *).  Looking in the GTK
source I can see no prototypes with any callback data (which would
certainly explain why you get bad pointers).  I've certainly prototyped
expose event handlers with a data pointer, but I've not used it before.

If this is the case, you'll probably need to attach the pointer as user
data to 'ZoneFourier' with something like

gtk_object_set_data(GTK_OBJECT(ZoneFourier), "psTab", (gpointer) psTab);

before attaching the callback, and then you can retrieve it with

sz = (struct stab *) gtk_object_get_data(GTK_OBJECT(zone_dessin),
                                         "psTab");

In the callback.

Not being able to pass user data to an expose callback does seem rather
silly and would also imply the reference docs were incorrect, and is
confusing anyway, so I've cc'ed this to the list in case anybody there can
offer an explanation.

Jonathan






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