Re: [gtk-list] Re: Key press event in drawing area
- From: Marc <marc upr41 univ-rennes1 fr>
- To: gtk-list <gtk-list redhat com>
- Subject: Re: [gtk-list] Re: Key press event in drawing area
- Date: Fri, 20 Nov 1998 09:12:00 +0100
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);
> gtk_widget_show (da);
> Then, you define your callback like:
> gint entry_callback (GtkWidget *w, GdkEventKey *event, gpointer data)
... obviously you mean keypress_callback...
> {
> g_print ("-I- Key Press %s\n", event->string);
> }
Anyway, the drawing area does'nt catches the key_press event.
With gtk_widget_set_events (da, GDK_KEY_PRESS_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_EXPOSURE_MASK);
and
gtk_signal_connect (GTK_OBJECT (da), "button_press_event",
(GtkSignalFunc) buttonpress_callback, NULL);
gint button_press_event (GtkWidget *widget, GdkEventButton *event,
gpointer data)
{
g_print ("button_press\n");
return TRUE;
}
The drawing area catches the button_press event.
Any idea ?
Thanks.
--
Marc
** ERROR **: sigsegv caught
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]