Hi all,
For the past 12 months, I have been developing an application with
several input screens using several numctrls. I have had a bug for some
time with numctrls that have min and max values set (lets say 100 and
200) and the initial call attempts to set a value in this range, say
101. In the past the control would be coloured as if the value 101 is
out of range.
This week I updated to wx 2.8.9.2 and now I seem to have developed a
further issue with numctrl.I suspect it’s related to my first issue.
I use Boa, here’s code for an example
self.numCtrl1 =
wx.lib.masked.numctrl.NumCtrl(id=wxID_FRAME1NUMCTRL1,
name='numCtrl1', parent=self, pos=wx.Point(88, 40),
size=wx.Size(36, 22), style=0, value=101)
self.numCtrl1.SetMax(200)
self.numCtrl1.SetBounds((100, 200))
self.numCtrl1.SetMin(100)
If I next add a line to call SetIntegerWidth(3) I get an error saying
that the value 101101 wont fit in the integer width I am trying to set.
I have attached some screen shots from Boa showing the
- numctrl on a frame with 101 set as it’s initial value
- the properties inspect showing me trying to change the field with
- boa reporting the wrong value 101101
Is it me? Or have I found a bug?
Thanks for any help/suggestions
timb



Hi Tim,
Tim Burgess wrote:
Hi all,
For the past 12 months, I have been developing an application with several input screens using several numctrls. I have had a bug for some time with numctrls that have min and max values set (lets say 100 and 200) and the initial call attempts to set a value in this range, say 101. In the past the control would be coloured as if the value 101 is out of range.
This week I updated to wx 2.8.9.2 and now I seem to have developed a further issue with numctrl.I suspect it's related to my first issue.
I use Boa, here's code for an example
self.numCtrl1 = wx.lib.masked.numctrl.NumCtrl(id=wxID_FRAME1NUMCTRL1,
name='numCtrl1', parent=self, pos=wx.Point(88, 40),
size=wx.Size(36, 22), style=0, value=101)
self.numCtrl1.SetMax(200)
self.numCtrl1.SetBounds((100, 200))
self.numCtrl1.SetMin(100)
If I next add a line to call SetIntegerWidth(3) I get an error saying that the value 101101 wont fit in the integer width I am trying to set.
I have attached some screen shots from Boa showing the
* numctrl on a frame with 101 set as it's initial value
* the properties inspect showing me trying to change the field with
* boa reporting the wrong value 101101
I can recreate this problem (even in wxPython 2.8.9.1), it seems to have to do with Boa's design time usage of the numctrl and probably a bug in the numctrl in this use case. As it looks that the numctrl thinks it has a "mask" length of 14 when it should only be 3.
You can work around this by not setting the value in the constructor but setting it after _init_ctrls (see attached).
Hopefully someone will be able to pin it down and come up with a patch for it.
Werner
numctrlissue1.py (1.31 KB)