From: phlip_cpp@... (Phlip) Date: 2001-10-14T00:22:38+09:00 Subject: [ruby-talk:22485] Gtk - detect Alt modifier? Mathieu Bouchard wrote: > On Sat, 13 Oct 2001, Phlip wrote: > > signal_connect("key_press_event") { |w, e| > > puts e.keyval } > > Those keyvals come out as big honkin' numbers, like 65470. > > Is there some facility in gtk.rb, or in gtk+, that can convert these > > numbers to humane strings, such as "F1"? I have seen this ability > > before in other libraries with the letters TK in them. > > I don't know about Gtk, but using RubyX11 (version 0.5), you can do: > > require "X11/Keysyms" > p X11::KeysymdefReverse[65470] > > #==> "F1" Ta! Now the next question. If the Ctrl, Alt or Graphic key(s) were down while the user mashed that F1... A> how do I know this? e.state picks up Shift, but how do I detect the others? B> how, modulo DIY, do I stringify them? -- Phlip http://www.greencheese.org/HatTrick