From dc7543e6e34ad52722ab70989a591ed654b67a07 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 22 Jan 2003 18:14:19 +0000 Subject: [PATCH] Updated wxTimeCtrl witha patch from Will Sadkin git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18869 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/wxPython/lib/timectrl.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) 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: