ruby-****@sourc*****
ruby-****@sourc*****
2012年 11月 6日 (火) 08:06:38 JST
------------------------- REMOTE_ADDR = 184.145.95.170 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-mnstbs-mnub ------------------------- @@ -9,7 +9,7 @@ Gtk::MenuBar is a widget that organizes multiple pop-up menus into a horizontal or vertical row. Each root element is a Gtk::MenuItem that pops down into a sub-menu. An instance of Gtk::MenuBar is usually displayed along the top of the main application window to provide access to functionality provided by the application. -In the following example program called 'menubars.rb' a Gtk::MenuBar widget is created with four menus: File, Edit, Organize and Help. Each of the menus is actually a Gtk::MenuItem with a sub-menu. A number of menu items are then added to each sub-menu. The Organize menu has two menu items. The first, Preferences, is a final (leaf) menu item and second Languages menu item is a actually a menu which contains a sub-menu with five leaf menu items. We create all the menu items as well as sub-menus and their menu items manually. This also gives us the opportunity to look at menu items' signal handling a bit more thoroughly than before, expanding the discussion to the keyboard accelerator keys, and how they relate to menu items and their signal handling mechanisms. +In the following example program called 'menubars.rb' a Gtk::MenuBar widget is created with four menus: File, Edit, Organize and Help. Each of the menus is actually a Gtk::MenuItem with a sub-menu. A number of menu items are then added to each sub-menu. The Organize menu has two menu items. The first, Preferences, is a final (leaf) menu item and second Languages menu item is a actually a menu which contains a sub-menu with five leaf menu items. We create all the menu items as well as sub-menus and their menu items manually. This also gives us the opportunity to look at menu items' signal handling a bit more thoroughly than before, expanding the discussion to the keyboard accelerator keys, and how they relate to menu items and their signal handling mechanisms. When you will be reading the example program listing, do not get overwhelmed with all the code, that looks like signal handling. If you look closer you will notice, that a good chunk of it actually is the code defining different accelerator keys. We will talk about it in a separate segment below. {{br}}