Navigation with arrow keys.

I need some help with navigating with the arrow keys (Up/Down).
In short I would like to figure out how to get the Up Arrow to behave like 'Shift-Tab' and the Down Arrow like 'Tab'.

The problem is I have a collection of Radiobox widgets (three buttons each) on a panel and the Radiobox appears to be catching the Arrow keys.

I have researched wxNavigationKeyEvent() and I am still unsure on how to use it.

Can someone point me in the right direction?

Thanks,
Scott

···

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.7.1 - Release Date: 6/13/2005

scott wrote:

I need some help with navigating with the arrow keys (Up/Down).
In short I would like to figure out how to get the Up Arrow to behave like 'Shift-Tab' and the Down Arrow like 'Tab'.

The problem is I have a collection of Radiobox widgets (three buttons each) on a panel and the Radiobox appears to be catching the Arrow keys.

I have researched wxNavigationKeyEvent() and I am still unsure on how to use it.

Can someone point me in the right direction?

In general you'll need to bind the EVT_KEY_DOWN event for the controls, and then call control.Navigate as needed for your navigation keys, and call evt.Skip() otherwise. Navigate will send the wx.NavigationKeyEvent for you. You may also need to use the wx.WANTS_CHARS style for the controls as well. That said, there may be some controls that don't work this way because the native widget may hook the key event before your handler gets a chance.

···

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

then call as needed for your navigation keys,

I tried and I couldn't figure out control.Navigate at all, so i tried a different approach...

> That said, there may be some controls that don't work
> this way because the native widget may hook the key event before your
> handler gets a chance.

True, so I bound the panels with wx.WANTS_CHARS and I got it to work with the default Tab behavior intact! :slight_smile:

If anyone is interested I'll post my solution.

Scott

Robin Dunn wrote:

···

scott wrote:

I need some help with navigating with the arrow keys (Up/Down).
In short I would like to figure out how to get the Up Arrow to behave like 'Shift-Tab' and the Down Arrow like 'Tab'.

The problem is I have a collection of Radiobox widgets (three buttons each) on a panel and the Radiobox appears to be catching the Arrow keys.

I have researched wxNavigationKeyEvent() and I am still unsure on how to use it.

Can someone point me in the right direction?

In general you'll need to bind the EVT_KEY_DOWN event for the controls, and then call control.Navigate as needed for your navigation keys, and call evt.Skip() otherwise. Navigate will send the wx.NavigationKeyEvent for you. You may also need to use the wx.WANTS_CHARS style for the controls as well. That said, there may be some controls that don't work this way because the native widget may hook the key event before your handler gets a chance.

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.7.3/15 - Release Date: 6/14/2005