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



Jay Barnes wrote:
g_signal_connect (G_OBJECT (button), "enter",
                      G_CALLBACK (enter_button), (gpointer) box);


If `box' is a ptr-to-widget at this point, then this is good so far...

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

    gtk_widget_hide(box);
}

I suppose this is what you would want `enter_button' to do ?

Is it possible that either 'box' is a wild pointer or that your
compiler is not complaining due to a prior declaration of somthing
like:

static gboolean enter_button = FALSE;


Other than some technical mistake; I dont see anything
fundimentaly wrong with your reasoning.

HTH,
                    -Tristan





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