Forum: Ruby-Gnome 2 the returned integer value

Posted by Pen Ttt (luofeiyu)
on 2010-06-01 13:10
there is tutorial,
http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk-signals-more
% irb --simple-prompt
>> require 'gtk2'
=> true
>> b = Gtk::Button.new("hoge")
=> #<Gtk::Button:0x40a2a858 ptr=0x8237df8>
>> b.signal_connect("clicked") { puts 1 }
=> 1
>> b.signal_connect("clicked") { puts 2 }
=> 2
>>
what i get is different from tutorial,which is right?
pt@pt-laptop:~$ irb
irb(main):001:0> require  'rubygems'
=> true
irb(main):002:0> require  'gtk2'
=> true
irb(main):003:0>  b = Gtk::Button.new("hoge")
=> #<Gtk::Button:0xb750b72c ptr=0x9114498>
irb(main):004:0> b.signal_connect("clicked") { puts 1 }
=> 9
irb(main):005:0>  b.signal_connect("clicked") { puts 2 }
=> 10
irb(main):006:0>
Posted by Mike Charlton (Guest)
on 2010-06-01 13:48
(Received via mailing list)
Hi.  I think the tutorial means that when you connect a signal
you get an integer back.  This integer is a tag to allow you to
keep track of the signal handler.  It doesn't have to be 1 or 2.
It can be anything.  The number that is returned is the
correct one.

It looks like you are making good progress.  Unfortunately
I had to work late tonight, so I couldn't prepare anything for
you.  But it looks like you are doing very well by yourself.
Please ask any questions that you want.  I will try to help.

        MikeC
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.