How do I pass a widget pointer to a function/callback?



This is a very basic question, but I could not derive the answer from
the on-line tutorial in my efforts to learn GTK+.

I have a program that puts an image inside of a button and puts that
button inside of a box. When the user mouses over the button/box, the
button should hide itself.

g_signal_connect (G_OBJECT (button), "enter",
                      G_CALLBACK (enter_button), (gpointer) box);

I am attempting to pass a pointer to the box containing the button to a
function/callback.

static void enter_ramen( GtkWidget *widget, gpointer box )
{

    gtk_widget_hide(box);
}

But when I actually enter the button boundary, it segfaults. I know
this has something to do with the incorrect method by which I am
passing the box to the function/callback, but I can't figure out how
this is supposed to be done short of declaring box globally, which is
not something I ought to be doing.

Any help would be appreciated.


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/



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