ruby-****@sourc*****
ruby-****@sourc*****
2012年 11月 5日 (月) 08:32:06 JST
------------------------- REMOTE_ADDR = 184.145.95.170 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-mnstbs-mnui ------------------------- @@ -285,7 +285,7 @@ "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 this sub-sub menu 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, which will have to be located in the source code before this step (#2). + The first menu item on our context menu's sub-menu is also a sub-menu with the name 'sub_submenu1'. The next item in this sub-sub menu 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, which will have to be located in the source code before this step (#2). -3-{{br}} Because the in the variable 'sub_submenu1' is also stored a menu, i.e. the submenu with two final (leaf) menu items, called 't1-test1' and 't1-test2', which will both potentially need different callback procs, step 3 first has to build the appropriate hash array and use it as the argument in the call to our 'mk_submenu' helper method. Finally, after this sub-sub menu is created, we also need to give it the((*name,*))so when it is used in the 'mk_submenu' method as the menu object, we will be able to assign this name to the menu item, which will represent the sub-menu. Let's see the code that needs to be written in this step #3: