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
This commit is contained in:
Robin Dunn
2003-01-22 18:14:19 +00:00
parent ffa5c6a998
commit dc7543e6e3

View File

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