[10656] in The GTK GIMP ToolKit mailing list archive
[gtk-list] Re: Signals and callbacks
daemon@ATHENA.MIT.EDU (Karl Mitchell)
Thu Dec 3 14:42:48 1998
Date: Thu, 03 Dec 1998 17:07:28 +0000
From: Karl Mitchell <k.l.mitchell@lancaster.ac.uk>
To: gtk-list@redhat.com
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com
Rodrigo Moya wrote:
> If what you mean is how to pass this data to the callback, you should
> replace the above function line with:
>
> gtk_signal_connect (GTK_OBJECT (event_box_right), "button_press_event",
> GTK_SIGNAL_FUNC (magnify_image), (gpointer) &_imageData);
>
> replacing _imageData with the name of the variable you want to pass.
> gpointer is just a void *.
To elaborate further, I tried the following and it gave an output of 683292. I
felt sure this would work. What have I missed? Please excuse the scrappy
cutting...
-----
void magnify_image( GtkWidget *widget, GdkEventButton *event, gint *data ){
...
g_print("%d", *data)
...
}
int main(int argc, char **argv){
gint *mf;
...
mf =1;
gtk_signal_connect (GTK_OBJECT (event_box_right), "button_press_event",
GTK_SIGNAL_FUNC (magnify_image), (gpointer) &mf);
...
}
-----
Cheers,
-Karl
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-Karl Mitchell=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| Planetary Science Research Group | Secretary, ISPRS WG IV/5 |
| Environmental Sciences Dept. | "Extraterrestrial Mapping" |
| I.E.N.S., Lancaster University | http://www.ge.ucl.ac.uk/isprs-etm |
| Lancaster LA1 4YQ, England, U.K. | tel/fax: +44(0)1524 593975/593985 |
=-=-=-=-=-=-=-=-=-=-=k.l.mitchell@lancaster.ac.uk=-=-=-=-=-=-=-=-=-=-=
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null