[Ironruby-core] Hiccup with WPF/Button events

Curt Hagenlocher curt at hagenlocher.org
Sat Oct 27 19:28:05 EDT 2007


On 10/27/07, Frank Aurich <lists at ruby-forum.com> wrote:
>
>
> I basically created a simple WPF Window and added several items to it,
> including 2 buttons. Each button has its own event block.
> Unfortunately, only one of the event blocks gets triggered, no matter
> which button I press.


In RubyActionBinder.HookEvent is the following code:

rule.SetTarget(rule.MakeReturn(wiringContext.LanguageContext.Binder,
    Ast.SimpleCallHelper(rule.Parameters[0], addMethod,
Ast.CodeBlockReference(handler, eventInfo.EventHandlerType))));

The rule is subsequently cached so that all handlers added to
System.Windows.Controls.Button.Click will get the same rule.  The rule is
only parameterized by target event -- not by code block -- which means that
subsequent code generation results in the same code block getting attached
to the event.

--
Curt Hagenlocher
curt at hagenlocher.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/ironruby-core/attachments/20071027/b9b32e6f/attachment.html 


More information about the Ironruby-core mailing list