Merge pull request #89 from wernerfb/june-timectrl

masked.timectrl
This commit is contained in:
Robin Dunn
2015-02-27 19:52:04 -08:00
2 changed files with 13 additions and 3 deletions

View File

@@ -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)

View File

@@ -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)