Bug in receiving key_press events
- From: "Damon Chaplin" <DAChaplin email msn com>
- To: "GTK List" <gtk-list redhat com>
- Subject: Bug in receiving key_press events
- Date: Wed, 25 Mar 1998 20:03:12 -0000
Hi,
If you connect a handler to 'key_press_event' in a window, you get each
key event twice.
(Strangely, if you use 'connect_after' you only get it once.)
Damon
Example source:
#include <gtk/gtk.h>
gint
on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
g_print("In on_key_press_event EventType:%i Key:%i String:%s\n",
event->type, event->keyval, event->string);
return TRUE;
}
int
main(int argc, char *argv[])
{
GtkWidget *win, *vbox, *scrollbar, *label;
gtk_init(&argc, &argv);
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_usize(win, 300, 150);
gtk_signal_connect (GTK_OBJECT (win), "key_press_event",
GTK_SIGNAL_FUNC(on_key_press), NULL);
gtk_widget_show(win);
gtk_main();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]