diff --git a/wxPython/wxPython/lib/timectrl.py b/wxPython/wxPython/lib/timectrl.py index 52a62b1279..63dad8b226 100644 --- a/wxPython/wxPython/lib/timectrl.py +++ b/wxPython/wxPython/lib/timectrl.py @@ -22,6 +22,15 @@ from wxPython.wx import * import string +# wxWindows' wxTextCtrl translates Composite "control key" +# events into single events before returning them to its OnChar +# routine. The doc says that this results in 1 for Ctrl-A, 2 for +# Ctrl-B, etc. However, there are no wxPython or wxWindows +# symbols for them, so I'm defining codes for Ctrl-X (cut) and +# Ctrl-V (paste) here for readability: +WXK_CTRL_X = (ord('X')+1) - ord('A') +WXK_CTRL_V = (ord('V')+1) - ord('A') + # The following bit of function is for debugging the subsequent code. # To turn on debugging output, set _debug to 1 _debug = 0 @@ -470,7 +479,8 @@ class wxTimeCtrl(wxTextCtrl): _dbg('keycode = ', key) _dbg('pos = ', pos) - if key in (WXK_DELETE, WXK_BACK): # don't allow deletion + # don't allow deletion, cut or paste: + if key in (WXK_DELETE, WXK_BACK, WXK_CTRL_X, WXK_CTRL_V): pass elif key == WXK_TAB: # skip to next field if applicable: @@ -756,6 +766,21 @@ class wxTimeCtrl(wxTextCtrl): _dbg(indent=0) + def Cut(self): + """ + Override wxTextCtrl::Cut() method, as this operation should not + be allowed for wxTimeCtrls. + """ + return + + + def Paste(self): + """ + Override wxTextCtrl::Paste() method, as this operation should not + be allowed for wxTimeCtrls. + """ + return + #---------------------------------------------------------------------------- # Test jig for wxTimeCtrl: