Re: DrawingArea and Toolbar focus issues



On Sat, 2007-09-08 at 18:15 +0200, Richard Boaz wrote:
> This is what I do:
> 
> 1) create a callback for mouse-enter events on your drawing area
> 2) execute gtk_grab_add() on the drawing area as part of this callback
> 3) all key events will now be routed correctly to your other callback(s)
> 4) execute gtk_grab_remove() for mouse-leave events on the drawing area
> 
> richard
> 
> ====
> 
> Hi.
> I've set up a GtkDrawingArea to catch keypress and keyrelease events.
> However, if a toolbar created via gtk_ui_manager_get_widget() is
> visible, the toolbar's first button seems to steal those events -
> despite my attempts to change the focus, disable key press/release
> events to the toolbar, etc. If the toolbar isn't visible, everything
> works as expected. Does anyone have any suggestions on this one?

Try:

  GTK_WIDGET_SET_FLAGS (drawing_area, GTK_CAN_FOCUS );
  gtk_widget_grab_focus (drawing_area);

As the GtkDrawingArea won't take focus by default. Works for me in the
gschem schematic capture program.

Regards,

Peter Clifton





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