Re: [gtk-list] Re: Signals and callbacks




>> >
>> 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.
>
Well, you access it by casting the gpointer parameter in your callback:

        struct _imageData *data = (struct _imageData *) gpointer_parameter;

and that's all



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]