gtk_signal_connect() and passing parameters
- From: Mazur Przemyslaw <shem_mazur yahoo com au>
- To: gtk-app-devel-list gnome org
- Subject: gtk_signal_connect() and passing parameters
- Date: Wed, 16 May 2001 10:22:17 +1000 (EST)
I'm having trouble passing any kind of parameters to
my call back functions. For example:
int i = 1456;
GTK_SIGNAL_FUNC(button1_callback), (gpointer) &i);
void button1_callback(GtkWidget *widget, gpointer
g_print("i: %d\n", *((int *)data));
Quite simply, I expect to see g_print() print 1456 as
the value of i. It does not. Instead, it prints 4.
Even more strange, if I double click on the button
(which is a checkbox button), it prints 5 instead.
This leads me to believe that what I'm getting via the
data parameter is something other than the address of
my i variable. I tried passing the value of i instead
(removing the &), and changing to g_print("i: %d\n",
data); but this gave me another bizzare value instead.
I've had two experienced programmers (although not
experienced in GTK) look at this and both are stuck
for a solution.
Anyone have ideas? I'm starting to think there's some
bug in my version of GTK.
shem_mazur yahoo com au
http://messenger.yahoo.com.au - Yahoo! Messenger
- Voice chat, mail alerts, stock quotes and favourite news and lots more!
] [Thread Prev