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:
@@ -22,6 +22,15 @@
|
|||||||
from wxPython.wx import *
|
from wxPython.wx import *
|
||||||
import string
|
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.
|
# The following bit of function is for debugging the subsequent code.
|
||||||
# To turn on debugging output, set _debug to 1
|
# To turn on debugging output, set _debug to 1
|
||||||
_debug = 0
|
_debug = 0
|
||||||
@@ -470,7 +479,8 @@ class wxTimeCtrl(wxTextCtrl):
|
|||||||
_dbg('keycode = ', key)
|
_dbg('keycode = ', key)
|
||||||
_dbg('pos = ', pos)
|
_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
|
pass
|
||||||
|
|
||||||
elif key == WXK_TAB: # skip to next field if applicable:
|
elif key == WXK_TAB: # skip to next field if applicable:
|
||||||
@@ -756,6 +766,21 @@ class wxTimeCtrl(wxTextCtrl):
|
|||||||
_dbg(indent=0)
|
_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:
|
# Test jig for wxTimeCtrl:
|
||||||
|
Reference in New Issue
Block a user