Re: Reference to a C++ object in GTK+ callbacks
- From: Paul Santa Maria <paulsm1021 yahoo com>
- To: Stephen Pollei <stephen pollei gmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Reference to a C++ object in GTK+ callbacks
- Date: Wed, 14 Dec 2005 13:30:22 -0800 (PST)
Thank you on all counts!
The main problem was my callback (duh! I forgot the "GtkWidget *w" argument!); I also changed all
my "gtk_signal_connect()" calls to g_signal_connect()", and all my "gtk_signal_connect_object()"
to g_signal_connect_swapped()".
It works fine now - thanx again!
--- Stephen Pollei <stephen pollei gmail com> wrote:
On 12/13/05, Paul Santa Maria <paulsm1021 yahoo com> wrote:
I'm coding in C++, but using the "raw" GTK+ C
libraries.
I'm doing similiar for a game I'm making.
------------------
gboolean
play_cb (gpointer data)
{
// Deference the object pointer to do the actual work
AnimationFile *ani = (AnimationFile *)data;
ani->start ();
}
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);
global_game.rocket_up(*city);
city->update_targets();
each_tick(NULL);
}
is what I have for one of my callbacks.
Maybe do a printf("%p",ani); and a printf("%p",m_animation);
to really make sure they point to the same thing.
"ani->start()" works fine outside of the callback. I know my Animation object has been
successfully created and that "m_animation" points to it before I call gtk_signal_connect().
Good does ani point to the same thing once inside the callback as
m_animation points to outside the callback?
--
http://dmoz.org/profiles/pollei.html
http://sourceforge.net/users/stephen_pollei/
http://www.orkut.com/Profile.aspx?uid=2455954990164098214
http://stephen_pollei.home.comcast.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]