Re: Passing values to functions
- From: Dino Cherian K <inimss yahoo com>
- To: Sven Neumann <sven gimp org>
- Cc: Shiraz Baig <shiraz_baig yahoo com>, gtk-list gnome org
- Subject: Re: Passing values to functions
- Date: Sun, 20 Jan 2002 12:01:44 +0530
Hi
Seeing this discussion I have a doubt.
What does this gpointer data in the function arguments mean.
How I can use it and in what all contexts.
> void callback (GtkButton *button,
> gpointer data);
Thanks
Dino
Sven Neumann wrote:
>
> Hi,
>
> Shiraz Baig <shiraz_baig yahoo com> writes:
>
> > I am a newbie. Can anyone tell me, in the following
> > elementary program, why doesn't the function "hello"
> > that it has not been passed any data. Because in
> > gtk-signal-connect, we are passing NULL data.
> > Wherefrom is this data coming. In another case, I have
> > seen drawing_area being passed like this. How does it
> > get to the function "hello".
>
> what was the question again? The code you posted looks
> OK and I can't see what your question is. data as passed
> to the function hello should indeed be NULL.
>
> If you have seen a drawing_area pointer in a signal
> callback where you expected your user_data you most
> probably connected a callback with a wrong signature.
> Not all signals are declared as the clicked signal
> of a GtkButton:
>
> void (* clicked) (GtkButton *button);
>
> which expects a callback of the form
>
> void callback (GtkButton *button,
> gpointer data);
>
> The signal "expose_event" of a GtkWidget for
> example is defined as
>
> gint (* expose_event) (GtkWidget *widget,
> GdkEventExpose *event);
>
> so you need to use a callback of the form
>
> gint callback (GtkWidget *widget,
> GdkEventExpose *event,
> gpointer data);
>
> Or you'd get the event pointer instead of the expected
> user_data.
>
> Salut, Sven
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]