keyboard events



Hi,

I am trying to capture key presses in a window, but the window seems
to be ignoring the signals.


GtkWidget* mainWindow = gtk_drawing_area_new();
...
gtk_widget_add_events(mainWindow, (GDK_KEY_RELEASE_MASK | GDK_KEY_PRESS_MASK));
gtk_signal_connect(GTK_OBJECT( mainWindow ),
                           "key_press_event",
                           G_CALLBACK( key_press_win ),
                           NULL);
...
static gboolean key_press_win(GtkWidget* w, GdkEventKey* key, gpointer data) {
   printf("press.\n");

   return false;
}


I was expecting to see some output on the console, but nothing shows
up. The window does also have mouse click event handlers, which work
fine....

Can anyone see what I have done wrong?


Thanks,

Richard



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