Re: [gtk-list] keypress events and DrawingArea
- From: Alistair Cunningham <ac212 cam ac uk>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] keypress events and DrawingArea
- Date: Thu, 28 May 1998 20:52:42 +0100 (BST)
On Thu, 28 May 1998, Janne Lof wrote:
>
>Hi,
>
>I am trying to capture keypress events for DrawingArea widget, but for
>some reason my keypress handler never gets called.
>
>Is following right way to do it, or am I forgetting something?
>
> widget = gtk_drawing_area_new();
> gtk_widget_set_events(widget,
> GDK_EXPOSURE_MASK|
> GDK_BUTTON_PRESS_MASK|
> GDK_KEY_PRESS_MASK);
>
> gtk_signal_connect(GTK_OBJECT(widget), "key_press_event",
> GTK_SIGNAL_FUNC(keypress), NULL);
Are you packing the drawing area into a scrolled window, or something
similar? If so, they get the keypresses, not the drawing area. For a
program I'm working on, I ended up with:
A drawing area
inside a scrolled widow
inside a event box
inside a top level window.
Then worked out whether the keypresses to the event box were for the
drawing area or scroll bars. Not nice.
No doubt someone more expert will now tell us the CORRECT way to do it.
Alistair Cunningham.
--------------------------------------------------------------------------
Alistair Cunningham Selwyn College, Cambridge Email: ac212@cam.ac.uk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]