I don't understand how TextCtrl.AutoComplete interracts with
EVT_TEXT_ENTER flag. The following codeclass ListTextCtrl(wx.TextCtrl):
def __init__(self, *args, **kwargs):
self.items = kwargs.pop('items', ) # default for items is empty listwx.TextCtrl.__init__(self, *args, **kwargs)
self.AutoComplete(self.items)
self.Bind(wx.EVT_TEXT_ENTER,self.Skip)def Skip(self, evt):
evt.Skip()### trying to get heredoes not reach line with '### trying to get here', while the following code
class ListTextCtrl(wx.TextCtrl):
def __init__(self, *args, **kwargs):
self.items = kwargs.pop('items', ) # default for items is empty listwx.TextCtrl.__init__(self, *args, **kwargs)
### self.AutoComplete(self.items) ## REMOVED
self.Bind(wx.EVT_TEXT_ENTER,self.Skip)def Skip(self, evt):
evt.Skip()### trying to get herereaches it fine.
Platform and version? Are you using the wx.TE_PROCESS_ENTER style flag?
Is there any way to use TextCtrl.AutoComplete, and EVT_TEXT_ENTER ?
It's not too surprising that an auto-complete feature would want to take the Enter key event for itself, although I haven't found anything that explicitly does that in the current implementation. (It could be doing it in the native code though.)
Some things you could try that may let you have first crack at the event before the auto-completer gets it:
1, Catch the EVT_KEY_DOWN event and see if there is an event for the Enter key there.
2. Create a class derived from wx.EvtHandler, and Bind a handler for EVT_TEXT_ENTER or EVT_KEY_DOWN there. Push an instance of that class on to your textctrl with PushEventHandler. Don't forget to Pop it later.
···
On 12/8/12 11:43 AM, Lou King wrote:
--
Robin Dunn
Software Craftsman