I finally found the time to play around with IronRuby today, so I
compiled the latest build and tried some of the example code out there.
When extending some WPF examples though, I ran into a problem with
Buttons and their assigned events, which looks like a bug to me.
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.
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.
Interesting. I can reproduce this when I run from a file but not when I
interactively type the text.
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:
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.
But how come it works in the interactive console but not when executed
from a file?
We’re trying to track down the cause of this, but we know that we’re not
building the correct rules for all cases in our ActionBinder. It’s
likely related to this, but we’re not sure right now.
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.
But how come it works in the interactive console but not when executed
from a file?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.