[ruby-gnome2-doc-cvs] [Hiki] update - tips_signals

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2004年 4月 5日 (月) 10:37:28 JST


-------------------------
REMOTE_ADDR = 200.216.146.191
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/en/?tips_signals
-------------------------
+ {{link nil, "Ruby-GNOME2+Tips", nil, nil}}
+ 
  = Investigate Signal behaviors
  How do you find signals which you need?
  
  Some representative signals are found in many samples, but others can't find anywhere even GTK+ API documents.
  
  This is the introduction how I find it.
  
  == 1 Try all signals in the widget which I need
  When I want to know the signals behaviors, I write test scripts as below at first.
  
  Try to click the widget, to press the keyboards, to move the widget, then you can investigate which/when signals are emitted.
  
   require 'gtk2'
   Gtk.init
   widget = Gtk::Button.new("click")        #(1)
   Gtk::Button.signals(false).each do |v|   #(2)
     p v
     widget.signal_connect(v) do
       p "#{v} is occured."
     end
   end
   Gtk::Window.new.set_default_size(100, 100).add(widget).show_all
   Gtk.main
  
  This is a example which use Gtk::Button. But also you can investigate other Widget/Signals to change (1) and (2).
  
  If you need to know superclass's signals, set true to GLib::MetaInterface.signals.
  
  == 2 Investigate a signal deeply
  Then, you find some signals to investigate deeply, try the script below.
  
   require 'gtk2'
   Gtk.init
   v = "clicked"                            #(1)
   widget = Gtk::Button.new("click")        #(2)
   widget.signal_connect(v) do
     p "#{v} is occured."
   end
   Gtk::Window.new.set_default_size(100, 100).add(widget).show_all
   Gtk.main
  
  Change (1), (2) as you need.
  
  == ChangeLog
  :2003-07-08 Masao Mutoh
   Initial Release





ruby-gnome2-cvs メーリングリストの案内
Back to archive index