Re: keyboard-focus for drawing-areas



Daniel Hempel wrote:

Hello,

I am new to this list but I searched now for several days in mailing lists and FAQs for the answer of a very 
basic and important question:

How can I receive keyboard events for a drawing area?

1. You have to add events mask (GDK_KEY_PRESS_MASK) to your widget, use gtk_widget_set_events() or gtk_widget_add_events(). 2. You can call gtk_grab_add(). When you grab your drawing area it will receive mouse and keyboard events. You can call this function when the mouse pointer is over the widget. When focus is not needed you
have to call gtk_grab_remove() so events will pass to another widgets.

gtk-doc/html/gdk/gdk-events.html
gtk-doc/html/gtk/gtk-general.html
gtk-doc/html/gtk/gtkwidget.html

As for books - I dont know, sorry.

Olexiy





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