nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

Validator - Nei controlli TextCtrl ho realizzato un validator ma i tasti freccia non funzionano

Von: LaGuNa (scozzaro@gmail.com) [Profil]
Datum: 04.07.2008 12:46
Message-ID: <c269eaac-4c1b-4ef7-b134-203d35cb7579@t54g2000hsg.googlegroups.com>
Newsgroup: it.comp.lang.python
Nei controlli TextCtrl ho realizzato un validator, che allego,  ma i
tasti freccia non funzionano, come mai?

class CharValidator(wx.PyValidator):
def __init__(self, flag):
wx.PyValidator.__init__(self)
self.flag = flag
self.Bind(wx.EVT_KEY_DOWN , self.OnChar)
def Clone(self):
"""
Note that every validator must implement the Clone()
method.
"""
return CharValidator(self.flag)
def Validate(self, win):
return True
def TransferToWindow(self):
return True
def TransferFromWindow(self):
return True
def OnChar(self, evt):
key = chr(evt.GetKeyCode())
if key == 9 or key == 91: return

if self.flag == "no-alpha" and key in
string.letters:
return
if self.flag == "no-digit" and key in string.digits:
return
evt.Skip()

by Enzo

[ Auf dieses Posting antworten ]