[Ironruby-core] delegate

Michael Letterle michael.letterle at gmail.com
Mon Feb 4 07:28:58 EST 2008


You /could/ do:

rbutton.Click {|sender, e| onClick sender}
rbutton2.Click {|sender, e| onClick sender}

Though that's still not "true" delegation :)

On Feb 4, 2008 5:56 AM, Huw Collingbourne <lists at ruby-forum.com> wrote:
> Michael Letterle wrote:
> > What I'm saying is eventually you'll be able to something like
> >
> > rbutton.Click{|sender, e| puts "Clicked!"}
> > rbutton.Click{|sender, e| puts "Also Clicked!"}
> >
>
> That's still not quite delegation in the usual sense. What if we have:
>
> def onClick( sender )
>   # do something
> end
>
> ...then have this single method 'wired up' to the Click events on, say,
> the 50+ buttons of a scientific calculator? In short, the delegated
> methods need to be detached from specific objects. I'm sure the IronRuby
> team will provide this in time. It makes a big difference when it comes
> to implementing code+form integration ;-)
>
>
> best wishes
> Huw
>
> SapphireSteel Software
> Ruby and Rails In Visual Studio
> http://www.sapphiresteel.com
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>



-- 
Michael Letterle
[Polymath Programmer]
http://michaeldotnet.blogspot.com


More information about the Ironruby-core mailing list