ruby-****@sourc*****
ruby-****@sourc*****
2012年 11月 7日 (水) 07:12:50 JST
------------------------- REMOTE_ADDR = 184.145.95.170 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-mnstbs-mnub ------------------------- @@ -174,8 +174,12 @@ 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. -If for the moment we ignore the next statement in which we create the accelerator group, and all accelerators related code, what remains is the code creating different menu items, the Language Gtk::Menu object with its menu items and the signal handler callbacks for all the leaf menu items. By now you should already be familiar these menu and sub-menu widgets which when attached to a Menu Bar work no different than when used alone in context menus. +At this point in our example program listing we come to the following code: + # We will use Accelerator keys in File, Edit and Language menus + group = Gtk::AccelGroup.new + +If for the moment we ignore the above statement, in which we create the accelerator group, and all accelerators related code, what remains is the code creating different menu items, the Language Gtk::Menu object with its menu items and the signal handler callbacks for all the leaf menu items. By now you should already be familiar these menu and sub-menu widgets which when attached to a Menu Bar work no different than when used alone in context menus. {{br}}