Capturing an Enter key and translating it to a TAB

Thanks for the method.

I changed my code as follows:
elif event.keyCode == 13: wx.Window.Navigate(self,wx.WXK_TAB)

When I run the app and press the enter key I get and UNHANDLED EXCEPTION
window. What am I doing wrong?

Heimburger, Ralph P wrote:

My picky users want me to remap the enter key so that when they press
enter it acts like a TAB has been pressed and takes them to the next
component/field/widget (Tab traversal). I have a current "keyPress"
procedure which uppercases everything and also handles some keys.

When you get the event for the enter key you need to send a
wx.NavigationKeyEvent. In 2.5.2.8 there is a helper function for that:

$ pydoc wx.Window.Navigate

Help on method Navigate in wx.Window:

wx.Window.Navigate = Navigate(*args, **kwargs) unbound wx._core.Window
method
     Navigate(self, int flags=NavigationKeyEvent.IsForward) -> bool

     Does keyboard navigation from this window to another, by sending a
     `wx.NavigationKeyEvent`.

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org