Re: passing on signals

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

 



Hi,

edscott wilson garcia <edscott@xxxxxx> writes:

>   Does anybody know the correct way to pass on keypressed signals
> received by one widget to another? Either of the following two lines
> causes gtk to segfault when signal received by GtkCombo is passed to
> GtkEntry:
> 
> gtk_signal_emit_by_name (GTK_OBJECT (entry),
> "key_press_event",event,data,NULL);
> 
> gtk_signal_emit_by_name (GTK_OBJECT (entry),
> "key_press_event",event,data);

Both lines are wrong. The user_data that is passed to a signal
callback is not set on signal emission but it's the data set when the
signal was connected. The correct code would be:

 gtk_signal_emit_by_name (GTK_OBJECT (entry), "key_press_event", event);

Actually this is deprecated API, so you would better use the following
instead:

 g_signal_emit_by_name (entry, "key_press_event", event);

This code assumes that event is a pointer to a GdkEventKey structure.


Sven
_______________________________________________

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