Re: [gtk-list] Keypress Events



>I was wondering if anyone can tell me where to look for information
>about handling key presses in a GTK window. For instance, if I wanted 
to
>
>hold down the "a" key and have a function execute over and over until
>the key was released. Where do I look to find out how to do this? There
>doesn't seem to be anything about it in the tutorial. If any one can
>help, thanks in advance.
>
>Brent Briggs
>
>
>
>-- 
>To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < 
/dev/null
>
>

Use gtk_signal_connect to attach a key press event to a function 
(example):

gtk_signal_connect (GTK_OBJECT (something), "key_press_event",
	GTK_SIGNAL_FUNC (something_else), (gpointer) your_data);

Then declare the function to handle the events as such:

void KeyPressEvent (GtkWidget *widget, GdkEventKey *event);

And inside the function, event->keyval contains the value of the key 
pressed.

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com



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