Hello:
I'm writing a custom wxGrid cell editor. The default editor will end an edit on a carriage-return key, and cancel an edit on the escape key. I am trying to expand that behavior so that an edit is ended on any arrow key with a change of the current cell in the appropriate direction.
I've subclassed wxPyGridCellEditor (as per one of the wxPython examples) and subclassed wxTextCtrl to trap the arrow keys in the text control (see the code below). Now I need to trigger the end of tthe current edit from code.
Does anyone know how to programmatically end the current edit?
Thanks in advance.
Mark
···
_____________________________________________
class CTextCellEditor(wxTextCtrl):
# Custom text control for cell editing
def __init__(self, parent, id):
wxTextCtrl.__init__(self, parent, id, "", style=wxNO_BORDER)
EVT_CHAR(self, self.OnChar)
# Hook OnChar for custom behavior
def OnChar(self, evt):
if evt.GetKeyCode() == WXK_DOWN:
# Now what???
pass
else:
evt.Skip()
class CCellEditor(wxPyGridCellEditor):
# Custom cell editor
def __init__(self):
wxPyGridCellEditor.__init__(self)
def Create(self, parent, id, evtHandler):
self._tc = CTextCellEditor(parent, id)
self._tc.SetInsertionPoint(0)
self.SetControl(self._tc)
if evtHandler:
self._tc.PushEventHandler(evtHandler)
[ lots of stuff deleted ]
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com