mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-04 19:10:09 +01:00
Fix setting IntCtrl to None wrongly raising
This commit is contained in:
@@ -15,6 +15,13 @@ class IntCtrlTests(wtc.WidgetTestCase):
|
|||||||
t3.ChangeValue(16)
|
t3.ChangeValue(16)
|
||||||
self.assertTrue(not t3.IsInBounds())
|
self.assertTrue(not t3.IsInBounds())
|
||||||
|
|
||||||
|
def test_canSetValueToNone(self):
|
||||||
|
t1 = IC.IntCtrl(self.frame, allow_none=True, value=None)
|
||||||
|
assert t1.GetValue() is None
|
||||||
|
t2 = IC.IntCtrl(self.frame, allow_none=True)
|
||||||
|
t2.SetValue(None)
|
||||||
|
assert t2.GetValue() is None
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -804,10 +804,10 @@ class IntCtrl(wx.TextCtrl):
|
|||||||
Colors text with oob_color if current value exceeds bounds
|
Colors text with oob_color if current value exceeds bounds
|
||||||
set for control.
|
set for control.
|
||||||
"""
|
"""
|
||||||
if not self.IsInBounds(value):
|
if value is None or self.IsInBounds(value):
|
||||||
self.SetForegroundColour(self.__oob_color)
|
|
||||||
else:
|
|
||||||
self.SetForegroundColour(self.__default_color)
|
self.SetForegroundColour(self.__default_color)
|
||||||
|
else:
|
||||||
|
self.SetForegroundColour(self.__oob_color)
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user