[IronPython] WPF/IronPython event handlers question - multiple event handlers

Ken MacDonald drken567 at gmail.com
Mon Jun 7 13:26:26 PDT 2010


Hi,
I've got a whole stack of event handlers, assigned via the usual something
like....

my_button.Click += button_was_clicked

As it turns out, the initialization for the thing that has all these
handlers may need to be run several times, and it seems like I ended up with
multiple copies of the same event handler, and "button_was_clicked()" now
gets invoked multiple times for EACH time I click my_button. It seems to be
solved by just skipping the handler assignment if I've already done it
before, but it seems odd that the same EH would be assigned and fired twice.
Is this really what I'm seeing? I can see a case for assigning multiple *
different* EH's:

my_button.Click += event_handler_1
my_button.Click += event_handler_2

but then this begs the question, is there a defined order in which the EH's
will fire? I looked thru multiple python/IronPython books and googled, but
came up empty on both questions..... Hopefully someone here understands
these things better than I do....
Ken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20100607/19a75d66/attachment.htm>


More information about the Users mailing list