ruby-****@sourc*****
ruby-****@sourc*****
2012年 10月 25日 (木) 09:28:29 JST
------------------------- REMOTE_ADDR = 184.145.49.94 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-mnstbs-popup ------------------------- @@ -285,9 +285,6 @@ === Accelerators can also be used in programs without menus -{{image_right("accelerator-keys-2.png")}} - - All accelerators, regardless of whether they are associated with menus or not, use global Gtk::AccelMap object which defines a list entries in this table in the form of mappings between a unique accelerator name (in the Gtk::AccelMap known as the ((*'accel_path')*))and the actual key combinations. These accelerators (keys) and/or 'accel_paths' eventually have to be mapped to actions either. There however, is a difference how actions are associated with menu item accelerators in windows with menus and in windows without menus, i.e. for windows themselves. First you will notice that in either case we use Gtk::Window#add_accel_group(group). Note, that this statement is mandatory only in the programs without menus, but should be included in programs with menus only when in addition to triggering actions through menu items you also wish to provide the access to this functionality via accelerator keys. The other more pronounced difference is how actions are associated either with menu items, or merely with the accelerator abstractions, as is the case in programs without the menus. While for menu items their respective actions are triggered by a specified signal (remember the((*"accel_signal='activate'"*)) parameter to the Gtk::Widget#add_accelerator method above), in programs without menus accelerator key actions are associated directly to the corresponding accelerator key abstractions (e.g.: 'accel_key,...' and 'accel_path'). This is accomplished with the help of 'Gtk::AccelGroup#connect(accel_key, accel_mods, accel_flags, closure)', 'Gtk::AccelGroup#connect(accel_key, accel_mods, accel_flags) {...}', or 'Gtk::AccelGroup#connect(accel_path, closure)', or 'Gtk::AccelGroup#connect(accel_path) {...}'.