Re: Bus failure using focus events

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

 



At Thu, Oct 02, 2003 at 07:35:27PM -0400, Ian Schorr wrote:
> On Thursday, October 2, 2003, at 01:06 PM, Ian Schorr wrote:
> >However, I noticed the different params and I'm not sure that I'm 
> >handling this properly (I don't believe I understand signals terribly 
> >well, to be honest with you).  I had assumed that in none of the code 
> >I've implemented, do I have to worry about the signal params - those 
> >were handled by GTK.  I just connect to the signal, and pass the 
> >signal-connect params.  Are you saying that I somehow have to build a 
> >GdkEventFocus object and pass it to focus-out-event?  I'm not sure 
> >that I'm actually generating the call with the GtkEntry or gpointer 
> >when I connect to "activate" now, so I'm not sure at what point this 
> >would be done.
> >
> Can someone maybe point me to example code implementing 
> "focus-out-event", particularly against a Text Entry widget?  That 
> might help me even more.  I've seen several references to it being used 
> this way, but I haven't found a good example (and the GTK docs need to 
> be taken out and shot).

In case you didn't understand what Peter said, the focus-out-event and
activate signals have different call signatures. If you change the
signal, the callback function needs to be modified accordingly.
Normally, the compiler catches improper numbers of arguments, but that
doesn't work here due to unavoidable casting to GCallback.

void activate_callback(GtkEntry *entry, gpointer user_data) {
  ...
}

gboolean focus_out_callback(GtkWidget *widget, GdkEventFocus *event,
                        gpointer user_data) {
  ...
}

...
  g_signal_connect(entry_box, "signal-name", signal_callback, data);

GTK/GDK takes care of passing in the relevant entry/widget/event, but
the same function can't be used in both cases. user_data is whatever
user_data was supplied to the g_signal_connect() call.

HTH

-- 
Chad Daelhousen
My opinions are my own, until UB purchases my soul.

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux