From: ts Date: 2001-10-13T21:30:10+09:00 Subject: [ruby-talk:22482] Re: Gtk - convert keyval to descriptive string? >>>>> "P" == Phlip writes: P> Is there some facility in gtk.rb, or in gtk+, that can convert these P> numbers to humane strings, such as "F1"? I have seen this ability P> before in other libraries with the letters TK in them. Well, I know nothing to Gtk, but the events are defined as constant in the module Gdk. If you want to test the key just test with the constant, for example : e.keyval == Gdk::GDK_F1 if you want a String you can perhaps make a reverse hash, something like this keyname = {} Gdk.constants.each do |k| if /^GDK_/ =~ k keyname[Gdk.const_get(k)] = k end end p keyname[65470] Probably there is a better way to do it Guy Decoux