ruby-****@sourc*****
ruby-****@sourc*****
2012年 10月 15日 (月) 09:17:06 JST
------------------------- REMOTE_ADDR = 184.145.82.7 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-kbda ------------------------- @@ -16,6 +16,17 @@ Currently, as of October 2012, there is a minor((*BUG*))in this area. Namely, one can not define more than a single modifier key in the model (if you wish to understand more about the bug, please search for the word BUG in the 'accelerators.rb' example program listing below). +Note however, that beside just mentioned minor rendering problem, the modifier keys are handled properly, and that even Gtk::CellRendererAccel handles them correctly, namely, if user enters, say, "<Shift+Ctrl+Alt>+X" combination into the editable renderer cell, we can analyze and detect all the components of the combined keystroke when processing((*'accel_edited'*))signal: + + renderer.signal_connect('accel_edited') do |w, path, accl_k, mask, hw_k| + if (iter = treeview.model.get_iter(path)) + iter[MASK_COLUMN] = mask + iter[VALUE_COLUMN] = accl_k + puts "accel_k:#{accl_k}=[" + + "#{Gdk::Keyval.to_name(accl_k)}] hw_k:#{hw_k} " + + "Modifier keys=#{get_string_for_modifier_keys(mask)}" + end + Following is the example program: {{br}}