diff --git a/unittests/test_lib_masked.py b/unittests/test_lib_masked.py index a8b3d452..dcc3ce88 100644 --- a/unittests/test_lib_masked.py +++ b/unittests/test_lib_masked.py @@ -95,7 +95,17 @@ class MaskedTimeCtrlTests(wtc.WidgetTestCase): #t = m.TextCtrl() #t.Create(self.frame) - + def test_timectrlIsValid(self): + t = m.TimeCtrl(self.frame, -1, "18:25:18") + + theTime = t.GetValue(as_wxDateTime=True) + self.assertEqual(theTime.hour, 18, "Hour: %s instead of '18'" % theTime.hour) + self.assertEqual(theTime.minute, 25, "Minutes: %s instead of '18'" % theTime.minute) + self.assertEqual(theTime.second, 18, "Seconds: %s instead of '18'" % theTime.second) + + self.assertEqual(t.IsInBounds(), True) + self.assertEqual(t.GetCtrlParameter('validBackgroundColour'), t.GetBackgroundColour()) + def test_timectrlProperties(self): t = m.TimeCtrl(self.frame) diff --git a/wx/lib/masked/timectrl.py b/wx/lib/masked/timectrl.py index 74f9e39c..f2a4c964 100644 --- a/wx/lib/masked/timectrl.py +++ b/wx/lib/masked/timectrl.py @@ -1254,7 +1254,7 @@ class TimeCtrl(BaseMaskedTextCtrl): def __OnChar(self, event): """ Handler to explicitly look for ':' keyevents, and if found, - clear the m_shiftDown field, so it will behave as forward tab. + clear the shiftDown field, so it will behave as forward tab. It then calls the base control's _OnChar routine with the modified event instance. """ @@ -1263,7 +1263,7 @@ class TimeCtrl(BaseMaskedTextCtrl): ## dbg('keycode:', keycode) if keycode == ord(':'): ## dbg('colon seen! removing shift attribute') - event.m_shiftDown = False + event.shiftDown = False BaseMaskedTextCtrl._OnChar(self, event ) ## handle each keypress ## dbg(indent=0)