From: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 2008-06-05 18:54:42
|
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. -- XXXXXXXXXXX |