I'm having problem with Emulatekeypress. I've been using a subclass of wx.grid.PyGridCellEditor to create my own customized grid editor. I've used Emulatekeypress in def StartingKey function override, so that when user press the starting key which trigger the editor, their keypress does not just lost, but instead, put propertly as the textcontrol first character.
self._tc.EmulateKeyPress(evt)
After 2.6.0, Emulatekeypress "generate" invalid keypress. Ie: "s" will trigger F4 (which since i bind F4 to show a query dialog, it pop that dialog!). And some time, Emulatekeypress does not generate any keypress at all. g become 7, d become 4, n become ., m become -, etc..
I'm having problem with Emulatekeypress. I've been using a subclass of wx.grid.PyGridCellEditor to create my own customized grid editor. I've used Emulatekeypress in def StartingKey function override, so that when user press the starting key which trigger the editor, their keypress does not just lost, but instead, put propertly as the textcontrol first character.
self._tc.EmulateKeyPress(evt)
After 2.6.0, Emulatekeypress "generate" invalid keypress. Ie: "s" will trigger F4 (which since i bind F4 to show a query dialog, it pop that dialog!). And some time, Emulatekeypress does not generate any keypress at all. g become 7, d become 4, n become ., m become -, etc..
This does not happen on 2.5.x
This probably has something to do with the change of when StartingKey is called. Previously it was called in the EVT_KEY_DOWN event, but this caused problems for non-US keyboards because the keycode in that case is the raw keycode and not yet mapped to the local character value.
Now StartingKey is called from the EVT_CHAR event, so the character value is correct, but since EmulateKeyPress is designed to emulate EVT_KEY_DOWN you end up with problems like what you are seeing. OTOH, since evt.GetKeyCode is now the real character value you don't really need EmulatKeyPress, just insert (or replace) the charcter into the text control.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!