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

Re: gpointer in callback function




Your callback should use a "gpointer" not a "gpointer *" - but that
shouldn't affect your code.

You should be able to get your pointer back using the following
callback:

gint XLogWindow::delete_ev(GtkWidget *w, GdkEvent
*ev, gpointer *p)
 {
    int *pint;

    pint = (int *) p;
    ...
 
    return(false);
}   



--- Gernot Kerschbaumer <gkerschb@frequentis.com> wrote:
> dear developers,
> 
> i'm working with a gtk application and i'm
> connecting signals to callback
> functions. my problem is that the pointer i'm
> passing to
> gtk_signal_connect() can't be retrieved by the
> callback function. 
> 
> example:
> 
> //connect signal:
> gtk_signal_connect(GTK_OBJECT(window),
> "delete_event",
> GTK_SIGNAL_FUNC(delete_ev), &key);     //key is an
> integer value
> 
> //callback function:
> gint XLogWindow::delete_ev(GtkWidget *w, GdkEvent
> *ev, gpointer *p)
> {
>    //doing something with data pointer p
>    ...
> 
>    return(false);
> }   
> 
> in the above example, the pointer p of the callback
> function points to a
> different location than the pointer i passed in
> gtk_signal_connect() so i
> can't work with the data.
> 
> is something wrong in my code?
> 
> thank you for any help.
> 
> gernot
> 
> -- 
> DI Kerschbaumer Gernot
> Software Development
> FREQUENTIS
> A-1120 Wien, Spittelbreitengasse 34
> gkerschb@frequentis.com
> 
> 
> -- 
>          To unsubscribe: mail
> gtk-app-devel-list-request@redhat.com with 
>                        "unsubscribe" as the Subject.
> 
> 	Mailing list concerns should be mailed to
> <listmaster@redhat.com>
> 
> 

_________________________________________________________
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]