Hello gtk-list, hello Havoc
Indeed, the following code does as intended; thank you
for the quick response!
> ...
> # A GLOBAL WIDGET REFERENCE
> GtkWidget *entry_copy = NULL;
>
> # OUR CALLBACK
> gint key_press_event_jump (GtkWidget *widget, > GdkEventKey *event) { > if (event->keyval == GDK_1) { > g_print ("found GDK_1\n"); >
>
gtk_signal_emit_stop_by_name (GTK_OBJECT (widget),
> "key_press_event"); >
>
gtk_widget_grab_focus
(entry_copy);
> gtk_widget_show (entry_copy); > return TRUE; > } > return FALSE; > } > ...
> # IN OUR MAIN FUNCTION
> entry_1 =
gtk_entry_new_with_max_length (80);
> gtk_widget_show (entry_1); > ...
> text_1 = gtk_text_new
(NULL, NULL);
> gtk_text_set_editable (GTK_TEXT (text_1), TRUE); > gtk_widget_set_usize (text_1, 400, 400); > gtk_widget_show (text_1); >
> entry_copy =
entry_1;
>
> gtk_widget_set_events
(text_1, GDK_KEY_PRESS_MASK);
> gtk_signal_connect (GTK_OBJECT (text_1), > "key_press_event", > (GtkSignalFunc) key_press_event_jump, > NULL); > ... Before realizing workable code, I tried looking in
gtkmain.c, just peeking.
Ahem.
Would it not be nice to have a "trace"
function mapping the calling hierarchy
of signals and events to stdout? This could perhaps help
in understanding the internals of the gtk main loop, or is such a function just
plain unnecessary?
Again, thank you, Frederik.
|