Re: Reference to a C++ object in GTK+ callbacks

On 12/13/05, Daryl Lee <dlee altaregos com> wrote:
Are you sure that is the right style for that callback?
static void
rocket_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data)
        class city_node *city=static_cast<class city_node *>(data);

C++ functions do, indeed, have to be "static" to be used as GTK+
Untrue I just removed the static keyword from 8 of my callbacks and
then recompiled, worked just fine. As Andy Grebe of apogeelabs said
"... function needs to have the correct format".
That I bet was the problem. That I label a lot of my callbacks with
"static", I just consider good style.
diff -u1 > static-out.diff

The only c++ problem I can see is if you had overloaded functions; I
can't think of how you'd select which one you meant.


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