Re: [gtk-list] Re: Signals and callbacks
- From: Karl Mitchell <k l mitchell lancaster ac uk>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Signals and callbacks
- Date: Thu, 03 Dec 1998 16:19:16 +0000
Rodrigo Moya wrote:
> Hi!
>
> >Secondly, signals and callbacks. I'm trying to implement a simple zoom
> routine
> >for each image, activated whenever the event box holding the image is
> clicked,
> >at present using:
> >
> > gtk_signal_connect (GTK_OBJECT (event_box_right), "button_press_event",
> > GTK_SIGNAL_FUNC (magnify_image), NULL);
> >
> >However, the magnify_image function needs quite a lot of information passed
> to
> >it:
> >
> > struct _imageData{
> > GdkImlibImage *image;
> > GtkWidget *pixmapwidget;
> > gint magnification_factor;
> > }
> >
> >, and for the life of me I can't work out how to do it. I think it's
> something
> >to do with my lack of understanding of gpointers. Could anyone help me work
> >this one out?
> >
> 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 *.
>
> I hope this was what you were asking.
That's about it. Thankyou! So how do you access the structure data in the
magnify_image function? I always seem to get confused when passing pointers
around the place.
-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=-=-=-=-=-=-=-=-=-=-=
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]