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

Ken MacDonald drken567 at gmail.com
Mon Feb 22 21:55:36 CET 2010

I've inherited an I-P app, and trying to make some sense of it... It has a
login page, with several text fields including "user" and "password"; and
"OK" and "CANCEL" buttons. Right now, you enter the user/password into the
text fields, and then have to click the "OK" button to login. Customer would
like this to work like most other apps, where filling in user/password and
then typing the "Enter" key would also initiate the login. I've searched the
I-P book and googled, but I can't find a workable reference to how to write
a handler to determine the Enter key has been hit - actually, I was able to
catch a keyboard event:

pwd_fld.KeyDown += on_enter

def on_enter(self, e, args)
    # what here???

but unable to determine what the keystroke is - "Iron Python In Action"

if e.Key == Key.Enter:
     # start login

but I get the error "e has no attribute 'Key'"

Clues appreciated....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100222/5585cc0b/attachment.html>

More information about the Ironpython-users mailing list