ruby-****@sourc*****
ruby-****@sourc*****
2012年 11月 5日 (月) 10:51:48 JST
------------------------- REMOTE_ADDR = 184.145.95.170 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-mnstbs-mnui ------------------------- @@ -488,9 +488,7 @@ #!/usr/bin/env ruby require 'gtk2' - menu = Gtk::Menu.new - radio_mi1 = Gtk::RadioMenuItem.new("_I want to be clicked!", true) radio_mi2 = Gtk::RadioMenuItem.new(radio_mi1, "_Click me instead!", true) radio_mi3 = Gtk::RadioMenuItem.new(radio_mi1, "No! Click _me!", true) @@ -520,20 +518,15 @@ menu.show_all window = Gtk::Window.new("Other Menu Items") - # Make window sensitive to Right-mouse-click, to open the pop-up menu. window.add_events(Gdk::Event::BUTTON_PRESS_MASK) window.signal_connect("button_press_event") do |widget, event| menu.popup(nil, nil, event.button, event.time) if (event.button == 3) end - # Make window sensitive to <Shift+F10> accelerator keys. These # accelerator keys generate the 'popup-menu' signal for window, # which opens the popup-menu. window.signal_connect("popup_menu") do |w| menu.popup(nil, nil, 0, Gdk::Event::CURRENT_TIME) end - window.set_default_size(250, 100).show_all window.signal_connect('destroy') { Gtk.main_quit } window.add(Gtk::Label.new("'Right-click' me to see menus"))