ruby-****@sourc*****
ruby-****@sourc*****
2012年 11月 8日 (木) 05:22:33 JST
------------------------- REMOTE_ADDR = 184.145.95.170 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-mnstbs-mnub ------------------------- @@ -196,7 +196,7 @@ {{image_left("submenu-as-context-menu.png")}} -So, next in our example program, we create the accelerator group, which will be used by the menu items on our File, Edit, and Languages menus (sub-menus) when clicked, but also by the accelerator keys. We will look more closely to these issues in the following section bellow. But in the meantime pay attention to a neat trick to open only a particular sub-menu as the main window's context menu, using by the developer provided accelerator key combination (here '<ctrl>+L'). {{image_right("language-submenu-s1.png")}} +So, next in our example program, we create the accelerator group, which will be used by the menu items on our File, Edit, and Languages menus (sub-menus) when the appropriate accelerator keys are pressed. We will look more closely to these issues in the following section bellow. But in the meantime pay attention to a neat trick to open only a particular sub-menu as the main window's context menu, using by the developer provided accelerator key combination (here '<ctrl>+L'). {{image_right("language-submenu-s1.png")}} You can see the result of this action on the image here on the left. Note that the Language menu, here shown as the context menu spawned from the main window with accelerator keys '<ctrl>+L', is actually a sub-menu on Organize menu (here on the right). To accomplish this we have to connect a menu-popup spawning callback to the desired accelerator key combination. We accomplish this by calling Gtk::AccelGroup#connect(accel_key, accel_mods, accel_flags) {...} method on the Gtk::AccelGroup object we created earlier: