Re: catching ESC key




On Jul 30, 2005, at 3:18 AM, Gábor Szabó wrote:

I could not figure it out with accelerators.

How can I catch when the user presses ESC?
For that matter how can I catch any other special key?

In what context? If you want to use ESC to clear a modal dialog, just make sure the dialog has a 'cancel' response, and Gtk2::Dialog::run() will do the rest. (The gtk+ team and the HIG folks have tried to work out when it makes sense to use ESC to clear dialogs, and make the toolkit Do The Right Thing.)

For anything else, ESC is just like any other key. Connect to 'key- press-event' and look for $event->keyval == $Gtk2::Gdk::Keysyms{Escape}.


--
Package contains eight 13-inch aliens in assorted colors.
 -- Catalog copy for space invaders wall decals.




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