ruby-****@sourc*****
ruby-****@sourc*****
2012年 10月 25日 (木) 10:44:10 JST
------------------------- REMOTE_ADDR = 184.145.49.94 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-mnstbs-popup ------------------------- @@ -261,7 +261,7 @@ clear.add_accelerator('activate', group, Gdk::Keyval::GDK_C, Gdk::Window::CONTROL_MASK|Gdk::Window::SHIFT_MASK, Gtk::ACCEL_VISIBLE) -To add an accelerator to a widget, you can use Gtk::Widget#add_accelerator method, which will emit the signal specified by the ((*"accel_signal='activate'"*)) parameter on the widget, when the user presses the key combination. Indeed for this to work, the accelerator group must be associated with the window and the menu items as mentioned earlier. The modifiers are specified in (((<GdkModifierType|Gdk::Window#GdkModifierType>))). Most often used modifiers are Gdk::Window::SHIFT_MASK, Gdk::Window::CONTROL_MASK, and Gdk::Window::MOD1_MASK, which correspond to Shift, Ctrl, and Alt keys respectively. The last parameter accel_flags (Gtk::ACCEL_VISIBLE) will make the accelerator visible in the label, Gtk::ACCEL_LOCKED will prevent the user from modifying the accelerator, Gtk::ACCEL_MASK will set both flags for the widget accelerator. +To add an accelerator to a widget, you can use Gtk::Widget#add_accelerator method, which will make sure the signal specified by the ((*"accel_signal='activate'"*)) parameter will be emitted, when the user presses the key combination on that widget (in our case indeed the clicked menu item). Indeed for this to work, the accelerator group must be associated with the window and the menu items as mentioned earlier. The modifiers are specified in (((<GdkModifierType|Gdk::Window#GdkModifierType>))). Most often used modifiers are Gdk::Window::SHIFT_MASK, Gdk::Window::CONTROL_MASK, and Gdk::Window::MOD1_MASK, which correspond to Shift, Ctrl, and Alt keys respectively. The last parameter accel_flags (Gtk::ACCEL_VISIBLE) will make the accelerator visible in the label, Gtk::ACCEL_LOCKED will prevent the user from modifying the accelerator, Gtk::ACCEL_MASK will set both flags for the widget accelerator. For your convenience following is the Gtk::Widget#add_accelerator API documentation. You can better understand its many parameters by reading the API segment that describes it: