> Ogle this snip: > > 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. > > (Remember I don't mean e.string - this is nothing if the key ain't no > ascii code point.) > > I'm just asking before I go trying to re-invent the wheel and get hung > up on which color to make it. Ruby/GTK lacks a wrapper to the function gdk_keyval_name() :( This can help, but loads the table very slowly... --- require 'gtk' keynames={} Gdk.constants.each { |c| if c =~ /^GDK_(.*)$/ keynames[Gdk.const_get(c)] = $1 end } puts keynames[65470] ---