Capturing an Enter key and translating it to a TAB

I also tried:

elif event.keyCode == 13:
    wx.Window.Navigate(self,wx.NavigationKeyEvent.IsForward)

This also causes and UNHANDLED EXCEPTION.

Ralph Heimburger
Babcock & Wilcox Enterprise Systems
330-860-1858

···

-----Original Message-----
From: Heimburger, Ralph P [mailto:rpheimburger@babcock.com]
Sent: Tuesday, September 14, 2004 9:23 AM
To: wxPython-users@lists.wxwidgets.org
Subject: RE: [wxPython-users] 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

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

"Heimburger, Ralph P" <rpheimburger@babcock.com> writes:

I also tried:

elif event.keyCode == 13:
    wx.Window.Navigate(self,wx.NavigationKeyEvent.IsForward)

This also causes and UNHANDLED EXCEPTION.

Try this:

elif event.keyCode == WXK_RETURN:
    wx.Window.Navigate(self,wx.NavigationKeyEvent.IsForward)

Take a look at http://wxwidgets.org/manuals/2.4.2/wx447.htm#keycodes for
other keycodes that might be useful to you.

Be seeing you,

···

--
Godoy. <godoy@ieee.org>

Most of the codes are not defined. Does this mean they can't be used or is
there something going on that is related to the platform ?
John

···

On Tuesday 14 September 2004 09:16, Jorge Godoy wrote:

"Heimburger, Ralph P" <rpheimburger@babcock.com> writes:
> I also tried:
>
> elif event.keyCode == 13:
> wx.Window.Navigate(self,wx.NavigationKeyEvent.IsForward)
>
> This also causes and UNHANDLED EXCEPTION.

Try this:

elif event.keyCode == WXK_RETURN:
    wx.Window.Navigate(self,wx.NavigationKeyEvent.IsForward)

Take a look at http://wxwidgets.org/manuals/2.4.2/wx447.htm#keycodes for
other keycodes that might be useful to you.

Be seeing you,

John Fabiani <jfabiani@yolo.com> writes:

Most of the codes are not defined. Does this mean they can't be used or is
there something going on that is related to the platform ?

Which codes?

···

--
Godoy. <godoy@ieee.org>

Heimburger, Ralph P wrote:

I also tried:

elif event.keyCode == 13:
    wx.Window.Navigate(self,wx.NavigationKeyEvent.IsForward)

This also causes and UNHANDLED EXCEPTION.

Is this in a EVT_CHAR or a EVT_KEY_DOWN handler? Which version of wxPython? Can you duplicate it in a small sample app?

···

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