ruby-****@sourc*****
ruby-****@sourc*****
2012年 11月 7日 (水) 07:58:21 JST
------------------------- REMOTE_ADDR = 184.145.95.170 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-mnstbs-popup ------------------------- @@ -7,7 +7,11 @@ You will begin this chapter by learning how to create a pop-up menu. A pop-up menu is a Gtk::Menu widget that is displayed to the user when the right mouse button is clicked when hovering above certain widgets, or when '((<window accelerator keys <Shift+F10>|tut-gtk2-mnstbs-popup#Note:>))' are pressed (provided, the application is programmed to catch this eventuality). -Lets start by creating a bare bones "Hello World" program, with the simplest possible context menu: + +The popup menu itself is created by the Gtk::Menu#popup(parent_menu_shell, parent_menu_item, button, activate_time){|menu, x, y, push_in| ... } method. We see a number of parameters including an optional user supplied block used to position the menu. Applications can use this method to display context-sensitive menus, and will usually supply nil for the 'parent_menu_shell' and 'parent_menu_item' parameters. When the user uses accelerator keys rather than mouse to open the context menu, the button parameter should be set to 0. Also if the action is invoked by accelerator keys, you would not have an event object which you would normally use to provide 'event.time'. In that case you would need to provide the time value by passing it Gdk::Event::CURRENT_TIME as 'activate_time' parameter. + +Lets start now by creating a bare bones "Hello World" program, with the simplest possible context menu: + ((*bare-bones-context-menu.rb*))