dabo Commit
Revision 3187
Date: 2007-06-20 10:34:24 -0700 (Wed, 20 Jun 2007)
Author: Paul
Trac: http://svn.dabodev.com/trac/dabo/changeset/3187
Changed:
U trunk/dabo/dEvents.py
U trunk/dabo/ui/uiwx/dGrid.py
Log:
With this commit, checkboxes in editable grid columns behave much more
similarly to
regular checkboxes. The moment the user toggles it, the underlying bizobj will
get
updated with the new value.
In addition, a new event is raised when the checkbox is toggled:
GridCellEditorHit.
In the future, we'll expand this to be raised for any type of editor, but for
now it
only works for checkboxes.
Completes ticket #1068
Diff:
Modified: trunk/dabo/dEvents.py
===================================================================
--- trunk/dabo/dEvents.py 2007-06-20 14:02:13 UTC (rev 3186)
+++ trunk/dabo/dEvents.py 2007-06-20 17:34:24 UTC (rev 3187)
@@ -709,6 +709,14 @@
pass
+class GridCellEditorHit(GridEvent):
+ """Occurs when the user changes the value in the grid cell editor.
+
+ For a checkbox, this occurs when the user toggles the checkmark.
+ This event is not implemented for other grid cell editors, yet.
+ """
+
+
class GridColSize(GridEvent):
"""Occurs when the grid's columns are resized."""
pass
Modified: trunk/dabo/ui/uiwx/dGrid.py
===================================================================
--- trunk/dabo/ui/uiwx/dGrid.py 2007-06-20 14:02:13 UTC (rev 3186)
+++ trunk/dabo/ui/uiwx/dGrid.py 2007-06-20 17:34:24 UTC (rev 3187)
@@ -3299,7 +3299,14 @@
ed = getattr(self, "_activeEditorControl", None)
if ed:
ed.SetValue(not ed.GetValue())
+ self._checkBoxToggled(ed)
+ def _checkBoxToggled(self, obj):
+ # Force the flushing of the value immediately, instead of
waiting for the
+ # editor to lose focus (where the flush will happen a second
time).
+ self._Table.SetValue(self.CurrentRow, self.CurrentColumn,
obj.GetValue())
+ self.raiseEvent(dabo.dEvents.GridCellEditorHit)
+
def __onGridCellLeftClick_toggleCB(self, evt):
col = self.Columns[evt.GetCol()]
if col.RendererClass == col.boolRendererClass:
@@ -3333,9 +3340,13 @@
else:
evt.Skip()
+ def onHit(evt):
+ self._checkBoxToggled(editor)
+
ed = self._activeEditorControl = evt.Control
ed.WindowStyle |= wx.WANTS_CHARS
ed.Bind(wx.EVT_KEY_DOWN, onKeyDown)
+ ed.Bind(wx.EVT_CHECKBOX, onHit)
evt.Skip()
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/dabo-dev/[EMAIL PROTECTED]