[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tut-gtk2-mnstbs-mnub

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 11月 7日 (水) 04:20:21 JST


-------------------------
REMOTE_ADDR = 184.145.95.170
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-mnstbs-mnub
-------------------------
@@ -174,13 +174,22 @@
 Since all menus are derived from Gtk::MenuShell abstract class, we assigning menu items to sub-menus, using Gtk::MenuShell#append(child). Note that we use the this instance method on both menu bar objects as well as on menus i.e. sub-menus, e.g.:((*'menubar.append(file)'*)) and((*'filemenu.append(new)'.*))We also have Gtk::MenuShell#prepend or Gtk::MenuShell#insert at our disposal.
 
 
+
 {{br}}
 
+#(9.5.1)
+=== Adding Keyboard Accelerators To Menu Items
 
 
+If you look at the images in this section or run the example program and check out the contents of the menus, you will notice that some menu items include keyboard accelerator key combinations. You will also realize that, we did not 'hard-code' these strings into menu item labels. They just magically appear on our menus. Well, not magically, we actually made them appear by creating Gtk::AccelGroup object and passing it as the parameter to the constructor of those menu items that need it (Gtk::ImageMenuItem.new(stock_id, accel_group), or if a particular menu item constructor does not accept 'accel_group' parameter add it to that menu item after it is created by calling the inherited Widget::add_accelerator(accel_signal, accel_group, accel_key, accel_mods, accel_flags) method on it. 
 
+
+
+{{br}}
+
 {{image_left("submenu-as-context-menu.png")}}
 
+
 Next 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")}}
 
 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). Next we will look at these and other tricks with accelerator keys more closely.
@@ -190,9 +199,20 @@
 {{br}}
 {{br}}
 
+#(9.5.2)
 === Keyboard Accelerators And Their Relationships With Menus And Other Widgets
 
 Though we have already discussed keyboard accelerators in section 9.2 '((<Keyboard Accelerators|tut-gtk2-mnstbs-popup#Keyboard Accelerators>))' now that we are familiar with menus, menu bars, and sub-menus we can expose also the relationships between them and other widgets such as top windows and other nested widgets particularly menu an sub-menu items.
+
 
 
 :Using Accelerator Path In Menus




ruby-gnome2-cvs メーリングリストの案内
Back to archive index