dabo Commit
Revision 4899
Date: 2008-12-29 14:22:39 -0800 (Mon, 29 Dec 2008)
Author: Paul
Trac: http://trac.dabodev.com/changeset/4899
Changed:
U trunk/dabo/ui/uiwx/dSpinner.py
Log:
dSpinner was firing ValueChanged and InteractiveChange with each keypress in the
textbox (IOW, these events fired as often as Hit). For text controls,
ValueChanged
should fire if the value was changed from _oldVal, when the focus is lost.
This fix seems to fix it to work like I expect, where typing in the text portion
doesn't flush the value every keypress, but clicking the buttons does.
Diff:
Modified: trunk/dabo/ui/uiwx/dSpinner.py
===================================================================
--- trunk/dabo/ui/uiwx/dSpinner.py 2008-12-29 19:19:42 UTC (rev 4898)
+++ trunk/dabo/ui/uiwx/dSpinner.py 2008-12-29 22:22:39 UTC (rev 4899)
@@ -80,8 +80,8 @@
ps.Bind(wx.EVT_SPIN_DOWN, self.__onWxSpinDown)
ps.Bind(wx.EVT_SPIN, self._onWxHit)
pt.Bind(wx.EVT_TEXT, self._onWxHit)
+ pt.Bind(wx.EVT_KILL_FOCUS, self._onLostFocus)
self.bindEvent(dEvents.KeyChar, self._onChar)
- self.bindEvent(dEvents.LostFocus, self._onLostFocus)
self._rerestoreValue()
@@ -161,6 +161,7 @@
else:
ret = False
self._checkBounds()
+ self._userChanged = True
self.flushValue()
self.raiseEvent(dEvents.Hit, hitType="button")
return ret
@@ -180,6 +181,7 @@
else:
ret = False
self._checkBounds()
+ self._userChanged = True
self.flushValue()
self.raiseEvent(dEvents.Hit, hitType="button")
return ret
@@ -215,8 +217,6 @@
typ = "text"
else:
typ = "spin"
- # Flush the data on each hit, not just when focus is lost.
- self.flushValue()
super(dSpinner, self)._onWxHit(evt, hitType=typ)
@@ -247,8 +247,8 @@
if (val > self.Max) or (val < self.Min):
self.Value = pt._oldVal
pt._oldVal = self.Value
+ self.flushValue()
-
def _numericStringVal(self, val):
"""If passed a string, attempts to convert it to the
appropriate numeric
type. If such a conversion is not possible, returns None.
@@ -416,6 +416,13 @@
def onHit(self, evt):
print "HIT!", self.Value, "Hit Type", evt.hitType
+
+ def onValueChanged(self, evt):
+ print "Value Changed", self.Value
+ print "___"
+
+ def onInteractiveChange(self, evt):
+ print "Interactive Change", self.Value
def onSpinUp(self, evt):
print "Spin up event."
_______________________________________________
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/[email protected]