Hi.
I wrote my own Validator derived from wxPyValidator. I use EVT_CHAR to
check incoming characters but this method won't work if someone pastes
wrong text into my window. I could try to catch other events too, but
I guess there are many different ways to paste text -- also depending
on the system (middle mouse button, shift-ins, ^V etc.)
The other way I tried is catching EVT_TEXT. I like this better but it
still ain't perfect:
def Check(self, event):
win = wxPyTypeCast(event.GetEventObject(), "wxTextCtrl")
newString = win.GetValue()
if not self.regex.match(newString) and len(newString) != 0:
win.SetValue(self.retezec)
if not wxValidator_IsSilent():
wxBell()
else:
self.string = newString
I thing in wxGTK code first SetValue is called and then cursor
position is modified. The result is that after pressing wrong key
cursor jumps to the right.
Any better ideas?
Thanks, Jan
···
--
Jan Fedak talk:jack@tornado.sh.cvut.cz
mailto:J.Fedak@sh.cvut.cz mailto:jack@mobil.cz
Linux - the ultimate NT Service Pack.