Re: Newbie question about signal handler args
- From: Stefano Esposito <ragnarok email it>
 
- To: gtk-list gnome org
 
- Subject: Re: Newbie question about signal handler args
 
- Date: Thu, 21 Apr 2005 23:42:06 +0200
 
On Thu, 21 Apr 2005 10:52:26 -0600
"Ansell, Larry" <Larry_Ansell maxtor com> wrote:
> Hi all,
Hi 
 
> When I connect to a signal
> 
> gtk_signal_connect( GTK_OBJECT( button ), "focus-in-event",
>                               GTK_SIGNAL_FUNC( buttonHandler ), argToPass );
If you're using Gtk+2.x, you should use g_signal_connect(GObject *object, GCallback *handler, gpointer data) function instead of the old gtk_signal_connect. If you're using Gtk+1.x you should consider to pass to the version 2.x.
> In my handler,
> [cut]
> I think that (*data) should be my "argToPass", but is "widget" a pointer to the button that got 
> the focus change event?
data is a gpointer to "argToPass", castable to any type of your choice (if you passed an int you'll get it as a gpointer and cast it to return to the original int, same for any other type). The widget argument is the widget that emitted the signal, so for you is a pointer to the button that got the focus change event
Greetings
Stefano
P.S.: If you want to do something when the button is clicked you should consider the clicked event instead of the focus-in
-- 
"Solo due cose sono infinite: l'universo e la stupidita' umana."
Albert Einstein
 
 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 Vuoi diventare un vero esperto sul Controllo di Gestione? Scopri come nella tua azienda puoi migliorare gli utili e ridurre le spese.
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=3214&d=21-4
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]