ruby-****@sourc*****
ruby-****@sourc*****
2012年 10月 25日 (木) 03:09:34 JST
------------------------- REMOTE_ADDR = 184.145.49.94 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-mnstbs-popup ------------------------- @@ -170,7 +170,7 @@ separator = Gtk::MenuItem.new fill = Gtk::MenuItem.new("Set as Complete") clear = Gtk::MenuItem.new("_Clear Progress") - + menu.append(pulse) menu.append(separator) menu.append(fill) @@ -182,13 +182,13 @@ menu.accel_group=(group) # Add the necessary keyboard accelerators. - # pulse.add_accelerator('activate', group, accel_key, accel_mods, accel_flags) + # Widget#add_accelerator('activate', group, accel_key, accel_mods, accel_flags) pulse.add_accelerator('activate', group, Gdk::Keyval::GDK_P, Gdk::Window::CONTROL_MASK, Gtk::ACCEL_VISIBLE) fill.add_accelerator('activate', group, Gdk::Keyval::GDK_F, Gdk::Window::CONTROL_MASK, Gtk::ACCEL_VISIBLE) clear.add_accelerator('activate', group, Gdk::Keyval::GDK_C, - Gdk::Window::CONTROL_MASK, Gtk::ACCEL_VISIBLE) + Gdk::Window::CONTROL_MASK|Gdk::Window::SHIFT_MASK, Gtk::ACCEL_VISIBLE) pulse.signal_connect('activate') { |w| pulse_activated(w, progb) } fill.signal_connect('activate') { |w| fill_activated(w, progb) } @@ -218,11 +218,10 @@ progbar.text = "Reset to Zero" end - window = Gtk::Window.new(Gtk::Window::TOPLEVEL) + window = Gtk::Window.new("Accelerators") window.resizable = true - window.title = "Accelerators" window.border_width = 10 - window.signal_connect('delete_event') { Gtk.main_quit } + window.signal_connect('destroy') { Gtk.main_quit } window.set_size_request(250, -1) # Create all of the necessary widgets and initialize the popup menu. @@ -234,7 +233,6 @@ progress.pulse_step = 0.05 create_popup_menu(menu, progress, window) - + eventbox = Gtk::EventBox.new eventbox.events = Gdk::Event::BUTTON_PRESS_MASK eventbox.signal_connect('button_press_event') do |w, event|