AcceleratorTable on OSX

Hi,

When I'm using AcceleratorTables in multiple controls (other than top level frames) as described in this post:

http://wxpython-users.1045709.n5.nabble.com/Use-of-AcceleratorTable-tp2337246p2337254.html

it doesn't work on OSX (tested with wx 3.0.0 and 2.8.11).

Attached is a minimal sample, the focused text control should change it's value when you press the "Insert" key. It works on Windows.

Am I doing something wrong?

Regards,
Toni

accel_test.py (677 Bytes)

I now see that it has issues with certain keys like “Insert” in particular, and that “WANTS_CHARS” can help for some.

Is this a platform limitation, and if so, is it documented somewhere?

···

Toni

On Wednesday, March 26, 2014 7:37:21 PM UTC+1, Toni Ruža wrote:

Hi,

When I’m using AcceleratorTables in multiple controls (other than top level
frames) as described in this post:

http://wxpython-users.1045709.n5.nabble.com/Use-of-AcceleratorTable-tp2337246p2337254.html

it doesn’t work on OSX (tested with wx 3.0.0 and 2.8.11).

Attached is a minimal sample, the focused text control should change it’s
value when you press the “Insert” key. It works on Windows.

Am I doing something wrong?

Regards,

Toni

Toni Ruža wrote:

I now see that it has issues with certain keys like "Insert" in
particular, and that "WANTS_CHARS" can help for some.

Is this a platform limitation,

Perhaps, or it may be related to the actual widget being used. Also, Mac keyboards don't have an Insert key, so it may be something that got overlooked because of that. Are there other keys with the same problem in your case? What does the KeyEvent sample in the demo display if you press the Insert key while the test panel has the focus?

and if so, is it documented somewhere?

Not that I can remember seeing.

···

--
Robin Dunn
Software Craftsman

The KeyEvent sample shows WXK_HELP when insert is pressed. I was using a PC keyboard via synergy, the physical Mac keyboard really was overlooked at the time.

However, these differences are minor annoyances. The bigger issue is that even when you change the previously attached accel_test to use WXK_HELP instead if WXK_INSERT (or any other accelerator), only the first TextCtrl ever gets the event – and it get’s it irregardless of what has the focus on the Frame.

I solved this for the moment with a hack by getting the focused control of the top level parent of the event object in the EVT_MENU handler, and delegating the event handling to the focused control if appropriate.

···

On Friday, April 11, 2014 2:38:02 AM UTC+2, Robin Dunn wrote:

Perhaps, or it may be related to the actual widget being used. Also,
Mac keyboards don’t have an Insert key, so it may be something that got
overlooked because of that. Are there other keys with the same problem
in your case? What does the KeyEvent sample in the demo display if you
press the Insert key while the test panel has the focus?

Toni Ruža