Re: key input get grab by other widget

ehml wrote:
> In the drawing-area, I assign "key press event" to it. It work find for
> like "a" and "b", but does not work for arrow key. Once I press a arrow
> the "check button" grab that input, and subsequently, all key is grab by
> "check button". The same will happen if I point at the menu-bar and click
in a
> empty space following by pressing a key. What I need is:
> If the pointer is in the drawing-area, drawing-area should grab all key

Hi again :) the problem is that GtkDrawingArea does not implement any of 
the focus stuff that other widgets have (eg. drawing a focus highlight, 
catching focus_in/_out events, etc.).

This means that keyboard input to a drawing area does not work well, 
especially if you mix drawing areas and widgets with "real" keyboard 

I think the best solution is to subclass drawing area and implement the 
gtk focus system. It's not actually that hard ... when I did this I 
think I read gtkbutton and based it on that code. As I recall, you just 
need to implement

expose (you need to add code to draw the focus indicator)


Aelbert Cuyp 13 February - 12 May 2002 

For information and tickets:

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