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

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 10月 31日 (水) 05:28:16 JST


-------------------------
REMOTE_ADDR = 74.14.158.59
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-mnstbs-mnui
-------------------------
@@ -248,7 +248,17 @@
     
     Here we define the top menu items. Note, that the second item saved in variable 'mitem2' is the sub-menu, hence no signal handling is required for this menu item. 
 
-    -2-{{br}} Next we proceed to the 
+    -2-{{br}} Next we proceed to the first sub-menu on the top menu, which we created in step #1 (well, on our top menu we have only one sub-menu item, but in general there could be more on every menu and/or sub-menu). The difference between, how we passed menu items to our 'mk_submenu' method in the earlier 'menuitems-n-submenus-1.rb' program and now, here in 'menuitems-n-submenus-2.rb' is, that instead of a list which was collected into the array parameter earlier, now we build a hash in which keys are the menu items, and the value is supposed to be the the callback proc for final (leaf) menu items which are passed in as String objects, and((*nul*))for the sub-menus and separators whicha are of type Gtk::Menu and Gtk::MenuItem respectively.
+    
+     # (2. menu building step)
+     top_menus_1st_submenu_hash = {
+       sub_submenu1 => nil,		# demands that 'sub_submenu1' is created by now => {{ step 3 }}.
+       Gtk::MenuItem.new => nil,
+       "t1-test1" => t1_test1_lambda,
+       "t1-test2" => t1_test2_lambda,
+     }
+
+    The first menu item on our context menu's sub-menu is also a sub-menu with the name 'sub_submenu1'. The next item is the separator (see: 9.1.1.1 ((<Menu Item Separators|tut-gtk2-mnstbs-popup#For Separators in menus use MenuItem with no label>))). Indeed, we need no callback here either, so just like for the the menu object stored in 'sub_submenu1' variable, the value for its hash entry is((*nil.*))As the comment in the third line above suggests, we will, next, need to make sure that the 'sub_submenu1' variable exists. This determines our next step #3.
 
 
 




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