[IronPython] Events on Buttons, and Focus, in IronPython

Ken MacDonald drken567 at gmail.com
Mon Feb 22 22:32:16 CET 2010


On Mon, Feb 22, 2010 at 4:12 PM, Curt Hagenlocher <curt at hagenlocher.org>wrote:

> You want args.Key instead of e.Key. The standard event signature is
> function(object sender, EventArgs args)
>

Tried that, but got runtime error saying that it was being called w/3
arguments, and only two were specified. Adding "self" as first argument
worked, however.


> But the better way to do this is to set the OK button to be the default
> button. In Winforms, this is a property on the form:
> form.AcceptButton = self.ok_button.
>
>
tried this approach as well (self is the login dialog):

ok_button == self.control("btnOk") // xaml name for it
ok_button.Click = self.on_ok
self.AcceptButton = ok_button

but no event seemed to be triggered on it. Anyway, the on_enter handler
works once I sorted out the arguments properly.
Ken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100222/6d48c72e/attachment.html>


More information about the Ironpython-users mailing list