ruby-****@sourc*****
ruby-****@sourc*****
2012年 11月 1日 (木) 03:31:40 JST
------------------------- REMOTE_ADDR = 74.14.158.59 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-mnstbs-mnui ------------------------- @@ -213,7 +213,7 @@ pulse.signal_connect('activate') { |w| pulse_activated(w, progb) } -The workhorse in the first part of our 'menuitems-n-submenus*.rb' project was the 'mk_submenu' method. But if we think about implementing most likely different signal handler callbacks for each menu and sub-menu item, we have a bit of a problem with our 'mk_submenu' method, which creates numerous menu items without providing us with the references to them. As we can see, in the following code segment, variable 'menuitem' is local to the block and repeatedly reused for different menu items. +The workhorse in the first part of our 'menuitems-n-submenus*.rb' project was the 'mk_submenu' method. But if we think about implementing (most likely different) signal handler callbacks for each menu and sub-menu item, we have a bit of a problem with our 'mk_submenu' method, which creates numerous menu items without providing us with the references to them. As we can see, in the following code segment, variable 'menuitem' is local to the block and repeatedly reused for different menu items. submenu = Gtk::Menu.new menuitems.each do |mi|