Re: Differences between kinds of events



Gnaural wrote:
Thanks for the reply. Using gtk_widget_add_events()
was a good tip in general, and the order in which I
call things too. But unfortunately, they didn't help
solve the question I still see.
I'll paste a very short program illustrating what I
mean below, in which I set-up a button-press and a
key-press handler in the same way for drawingarea1,
but only the button-press responds. But if I merely
change "drawingarea1" to "window1" in the key-press
g_signal_connect(), it catches key presses just fine:

Hi,
    Sorry I didnt think of this but; in order to recieve
keyboard events; you have to have it in your event mask
(I already said that) but you *also* have to have keyboard
focus, keyboard focus usually naturally goes to the widget
that recieved the last mouse event; or programatically
gtk_widget_grab_focus(); or it can be tabbed to through
the "focus chain" (which can be declared for any said container).

What your probably missing in your code is:
    GTK_WIDGET_SET_FLAGS (drawingarea, GTK_CAN_FOCUS);

Cheers,
                 -Tristan



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