GadgetSteve: Thanks for the suggestion it pointed me in the right direction.
I went and checked out the code and this is what I found:
1. The bell is occurring because the EVT_TEXT_ENTER handler is calling
Skip(). Therefore it gets passed up the hierarchy and at some point I guess
when it gets to the OS it generates the bell.
2. I also found another "bug" (or at least behavior I did not want). When
you enter values outside of the min or max more than once in succession -
the second entry does not update the underlying wx.TextCtrl even though the
value is correct. This only occurs if you go "high" twice in a row or "low"
twice in a row. This is a pretty minor nit - but easily fixed nontheless
...
To solve both of these I override the OnTextEnter method.
BTW - Is wx.lib.agw.floatspin being actively maintained? Where I look to
submit bug reports or update the source?
For completeness I though I would post the solution that I am using.
Clearly some of this would best be addressed in the source itself.
···
-----------------------------------------------
import wx
from wx.lib.agw import floatspin
class MyFloatSpin(floatspin.FloatSpin):
def __init__(self, *args, **kwds):
floatspin.FloatSpin.__init__(self, *args, **kwds)
def OnTextEnter(self, evt):
self.SyncSpinToText()
self.SetValue(self.GetValue())
app = wx.PySimpleApp()
frame = wx.Frame(None)
panel = wx.Panel(frame)
float_spin = MyFloatSpin(panel, -1, value=0,
increment=0.1,
min_val = 0,
max_val = 10,
agwStyle=floatspin.FS_CENTRE)
float_spin.SetDigits(2)
frame.Show()
app.MainLoop()
--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/Bell-on-Enter-with-FloatSpin-object-tp4828816p4831934.html
Sent from the wxPython-users mailing list archive at Nabble.com.