Re: Reference to a C++ object in GTK+ callbacks
- From: Stephen Pollei <stephen pollei gmail com>
- To: Daryl Lee <dlee altaregos com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Reference to a C++ object in GTK+ callbacks
- Date: Wed, 14 Dec 2005 11:19:20 -0800
On 12/13/05, Daryl Lee <dlee altaregos com> wrote:
Are you sure that is the right style for that callback?
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 gtk_main.cc-save gtk_main.cc > 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.
] [Thread Prev