Re: passing on signals
- From: Sven Neumann <sven gimp org>
- To: edscott imp mx
- Cc: gtk-list gnome org
- Subject: Re: passing on signals
- Date: 02 Oct 2003 21:04:28 +0200
Hi,
edscott wilson garcia <edscott imp mx> 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]