Re: Is "process enter" possible with textfields in PythonCard?

Neil Hughes <[email protected]> Thu, 05 Jun 2008 19:54:45 +0100
Newsgroups gmane.comp.python.pythoncard
Message-ID <[email protected]>
On 05/06/2008 15:19, Alec Bennett wrote:
> I'm working on a PythonCard project and can't figure out if it's 
> possible to set a wx.TE_PROCESS_ENTER style on a textfield. In other 
> words, I'd like to be able to trigger an event (for example a submit 
> button type event) when the user presses the enter key while they're in 
> a text field.
> 
> Is this possible with PythonCard?

On some of my windows I have a username text field and password text 
field, but I want the return/enter key to act the same as the login 
button next to them, so I use this:

     def on_keyDown(self, event):
         if(event.keyCode == wx.WXK_RETURN):
             if(self.components.LoginButton.enabled == True):
                 self.on_LoginButton_mouseClick(event)

on_keyDown() is catching keyboard events not trapped by any specific 
widget, but you should be able to use

on_<text field name>_keyDown()

to only listen to the specific text field widget you want.

-- 
Neil Hughes

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php