Re: [gtk-list] Re: Key press event in drawing area




On Fri, 20 Nov 1998 09:12:00 +0100
	marc@upr41.univ-rennes1.fr(Marc)  said:
marc> Brandon Long wrote:

> You have to both allow the events, and set up a handler for the keypress
> event, something like:
> 
> da = gtk_drawing_area_new ();
> /* some code to place da */
> /* Connect your callback to the signal */
> gtk_signal_connect (GTK_OBJECT (da), "key_press_event",
>                     (GtkSignalFunc) keypress_callback, NULL);
> /* Unmask the signal */
> gtk_widget_set_events (da, GDK_KEY_PRESS_MASK | GDK_EXPOSURE_MASK);

  /* It makes to catch focus */
  GTK_WIDGET_SET_FLAGS(da, GTK_CAN_FOCUS);
  gtk_window_set_focus (GTK_WINDOW(window), da);

> gtk_widget_show (da);

> Then, you define your callback like:
> gint entry_callback (GtkWidget *w, GdkEventKey *event, gpointer data)
...
marc> Anyway, the drawing area does'nt catches the key_press event.


I think it will works...
--
Mitsuru Oka
<95i44@is.kochi-u.ac.jp>



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