For and event, you can use a block:
l = lambda {|s,e| do.stuff.here }
foo.event_name.add &l
foo.event_name.remove &l
Thanks,
JD
...there is no try
http://blog.jredville.com
From: [email protected]
[mailto:[email protected]] On Behalf Of Martin Smith
Sent: Monday, August 03, 2009 11:47 AM
To: [email protected]
Subject: [Ironruby-core] Getting a delegate in IronRuby
Hello,
I was wondering how I can get a delegate in IronRuby.
One thing I was thinking about doing was trying to attach an event handler with
an EventInfo and it requires a delegate. It has a method called
AddEventHandler(object, Delegate), and i wanted to attach an event handler.
But I can't find any way to get a delegate in ruby. How would you guys do it?
I know i can also use:
object.send(event_name) { |*e| ...... }
In that case how would i remove that event handler?
Thanks in advance,
Martin
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core