Re: handling key-press events
Andy Wingo <[email protected]> Sun, 17 May 2009 15:34:56 +0200
| Newsgroups | gmane.lisp.guile.gtk |
|---|---|
| Message-ID | <[email protected]> |
On Thu 14 May 2009 20:42, Paul Emsley <[email protected]> writes: > tantalum wrote: >> >> Can anyone show me with a little code snippet, how to >> check for a specific key pressed with a key-press-event? I could not >> find the answer myself. > > (gtk-signal-connect entry "key-press-event" > (lambda (event) > (if (= 65293 (gdk-event-keyval event)) ; GDK_Return > (begin > (handle-your-string entry) > (gtk-widget-destroy window))) Correct, though I'd write: (connect entry 'key-press-event (lambda (event) (case (gdk-event-keyval event) ((gdk:Return) (handle-your-string entry) (destroy window))))) > I don't know that the keysyms are available at the guile level - I had > to translate from gdkkeysyms.h :) (use-modules (gnome gtk gdk-event) Cheers, Andy -- http://wingolog.org/