Problem: no key press/release events.



Hi

I've been writing a program where I like to get key press/release events
in addition to mouse button press/release events to an eventbox widget
inside a window.

I've written the following:

  gtk_widget_set_events(gi.eb,
			GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK|
			GDK_KEY_PRESS_MASK|GDK_KEY_RELEASE_MASK);

  gtk_signal_connect(GTK_OBJECT (gi.eb), "key_press_event",
		      GTK_SIGNAL_FUNC (key_press), &gi);
  gtk_signal_connect(GTK_OBJECT (gi.eb), "key_release_event",
		      GTK_SIGNAL_FUNC (key_release), &gi);

  gtk_signal_connect(GTK_OBJECT (gi.eb), "button_press_event",
		      GTK_SIGNAL_FUNC (button_press), &gi);
  gtk_signal_connect(GTK_OBJECT (gi.eb), "button_release_event",
		      GTK_SIGNAL_FUNC (button_release), &gi);

All the functions "connected abobe" printf's the event happened. Now
I do get button prese/release events displayed on the terminal whenI
pressed any of the mouse buttons, but no keu press/release events when I
typed something over the eventbox.

What have I missed to get the key press/release events to work ?

Tomi





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