I've seen a very recent thread on this subject but the solutions there
don't seem to work for me.
http://aspn.activestate.com/ASPN/Mail/Message/wxPython-users/2004750
recommends:
if self.IsCellEditControlEnabled():
self.HideCellEditControl()
self.SaveEditControlValue()
http://aspn.activestate.com/ASPN/Mail/Message/wxPython-users/2004429
recommends:
row = self.GetGridCursorRow()
col = self.GetGridCursorCol()
ctrl = self.GetCellEditor(row, col).GetControl()
if (ctrl != None and ctrl.IsShown()):
val = ctrl.GetLabel()
else:
val = self.GetCellValue(row, col)
but in either case, the behavior seems inconsistent.
rpm install of wxpython wxPythonGTK-py2.3-2.4.2.4-1
My Hybrid:
def OnKillFocus(self, evt):
""" When a control looses focus, it's important to save the
value because to the end user, they think they are done editing
"""
print "kill focus event!"
if self.IsCellEditControlEnabled():
self.HideCellEditControl()
self.SaveEditControlValue()
# self.ForceRefresh()
row = self.GetGridCursorRow()
col = self.GetGridCursorCol()
ctrl = self.GetCellEditor(row, col).GetControl()
if (ctrl != None and ctrl.IsShown()):
val = ctrl.GetLabel()
else:
val = self.GetCellValue(row, col)
print "val is %s" % val
Test Case:
1) Launch modified GridCustTable.py (attached)
2) Double Click on blank cell in last row to launch cell editor
3) Type z without hitting enter
4) click on the blank area underneath the grid
5) note stderr output:
RESULT:
kill focus event!
val is
EXPECTED RESULT:
kill focus event!
val is z
It knows the EditControl is enabled but SaveEditControlValue doesn't
seem to generate the output I expect.
Help is greatly appreciated
···
--
Chris Green <cmg@dok.org>
"I'm beginning to think that my router may be confused."