Re: g_signal_connect isn't working
- From: Pier-Luc Charbonneau <pierluc charbonneau gmail com>
- To: Olexiy Avramchenko <olexiy ctech cn ua>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: g_signal_connect isn't working
- Date: Fri, 11 Mar 2005 08:21:45 -0500
Thanks to Arren and Olexiy I finaly got it working
On Fri, 11 Mar 2005 09:16:58 +0200, Olexiy Avramchenko
<olexiy ctech cn ua> wrote:
Pier-Luc Charbonneau wrote:
static gboolean recalculate_psi_consumption(GtkWidget *widget, gpointer data)
This is your callback declaration. It takes 2 parameters.
g_signal_connect(G_OBJECT(start),"key_press_event",G_CALLBACK(recalculate_psi_consumption),(gpointer)psi);
"key-press-event" signal handler must take 3 parameters, look at:
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidget-key-press-event
You have to make a wrapper over your callback, smth like:
static gboolean wrapper (GtkWidget *widget, GdkEvent *event, gpointer data)
{
recalculate_psi_consumtion (widget, data);
return FALSE; /* or TRUE if you dont want other callbacks to pop-up */
}
g_signal_connect(G_OBJECT(button),"clicked",G_CALLBACK(recalculate_psi_consumption),(gpointer)psi);
This one is Ok. "clicked" callback takes 2 parameters, like your callback.
Keep in mind that all "*-event" callbacks want three parameters: widget, event
structure and user data. Even more - they should return gboolean value: TRUE
means that event was processed and FALSE means that event wasn't processed and
all other callbacks will be called.
Olexiy
--
"Nine megs for the secretaries fair
Seven megs for the hackers scarce
Five megs for the grads in smoky lairs
Three megs for system source
One disk to rule them all
One disk to bind them
One disk to hold the files
And in the darkness grind 'em"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]