Re: about kep mapping



manu aradhya wrote:

can anybody tell me how to write a simple program to
handle keys, if i press 'a' i have to call a function
xyz. is it restricted to particular widget,can anybody
guide me. thnx -manu
All widgets have an "Event Mask" :
   http://developer.gnome.org/doc/API/2.0/gdk/gdk-Events.html#GdkEventMask

which can be set with:
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-add-events

Some widgets already have `GDK_KEY_PRESS_MASK' in thier mask but you must make sure.

now you can connect a signal handler to the widget that will recieve the `key press' like so: http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidget-key-press-event

details about the key press will be stored in:
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Event-Structures.html#GdkEventKey

=================== a few docs ======================
This is a list of events delivered to GTK by GDK and propagated by the GtkWidget:
   http://developer.gnome.org/doc/API/2.0/gdk/gdk-Event-Structures.html

This is a list of different widgets and thier API's:  ("object hierarchy")
   http://developer.gnome.org/doc/API/2.0/gtk/ch01.html

Events that are a result of a widget's logic are available as a signal belonging to that widget (i.e. the "clicked" signal of the GtkButton is a result of counting the button-press followed by a button-release without any "leave-notify") and
are described in the latter docs

Events that are delivered more or less in thier original raw form are described in
the former docs.

Hope this helps to get you started ;-)
(I must really have nothing to do)

Cheers,
                                       -Tristan






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