RE: [gtk-list] Need advice on key_press_event.



Hi,

You should call gtk_widget_grab_focus (<canvas widget>) to lead all default events to that widget (I presume you have a GtkDrawingArea as canvas). Note that you have to do that after you realized the widget and it's parent widgets (let's say after a gtk_widget_show_all () ).
This works fine for my widget (DiaCanvas at http://web.inter.nl.net/hcc/klem/diacanvas.html).

regards,

Arjan

> -----Original Message-----
> From: Preben Randhol [mailto:randhol@pvv.org]
> Sent: Wednesday, September 01, 1999 9:09 AM
> To: gtk-list@redhat.com
> Subject: [gtk-list] Need advice on key_press_event.
> 
> 
> 
> Hi
> 
> We have made a canvaswidget (not the Gnome canvaswidget) that can be
> scrolled up and down. What I know want to do is to add keybindings for
> Pg_Down and Pg_Up (and some other keys as well). 
> 
> I can do this with an eventbox attached to the canvaswidget, but that
> requires that the widget has focus. I would very much like to be able
> to press Pg_Down no matter which widget has focus (perhaps except
> entry/combobox widgets though) and get the canvas to scroll.
> 
> How would you go about to do this? Is there a mechanisme for doing
> this. As the menu has shortcuts that work without the menubar having
> focus, I thought there might be one.
> 
> Any hints much appreciated.
> 
> -- 
> Preben Randhol             oO     "Don't think about 
> domination,  think
> [randhol@pvv.org]        .`  ;     about freedom, it doesn't 
> dominate."
> [www.pvv.org/~randhol/]   \ G                  -- RMS, 
> LinuxWorld 1999.
>                            `_) n o m e 
> 
> -- 
> To unsubscribe: mail -s unsubscribe 
> gtk-list-request@redhat.com < /dev/null
> 



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