<div><span class="gmail_quote">On 10/27/07, <b class="gmail_sendername">Frank Aurich</b> &lt;<a href="mailto:lists@ruby-forum.com">lists@ruby-forum.com</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>I basically created a simple WPF Window and added several items to it,<br>including 2 buttons. Each button has its own event block.
<br>Unfortunately, only one of the event blocks gets triggered, no matter<br>which button I press.</blockquote>
<div>&nbsp;</div>
<div>In RubyActionBinder.HookEvent is the following code:</div>
<div><br>rule.SetTarget(rule.MakeReturn(wiringContext.LanguageContext.Binder, <br>&nbsp;&nbsp;&nbsp; Ast.SimpleCallHelper(rule.Parameters[0], addMethod, Ast.CodeBlockReference(handler, eventInfo.EventHandlerType))));<br>&nbsp;</div>
<div>The rule is subsequently cached so that all handlers added to System.Windows.Controls.Button.Click will get the same rule.&nbsp; The rule is only parameterized by target event --&nbsp;not by code block -- which means that subsequent code generation results in the same code block getting attached to the event.
</div>
<div>&nbsp;</div>
<div>--</div>
<div>Curt Hagenlocher</div>
<div><a href="mailto:curt@hagenlocher.org">curt@hagenlocher.org</a></div></div>