This thing is pretty cool! I found a way to trick the regexp in "Last Name
Only".
I enter the name, then click the mouse somewhere past the last character in
the name, and the edit control lets me continue to type with spaces between
the last name and my name.
I'm using wxMSW, by the way.
jw
···
-----Original Message-----
From: Jeff Childers [mailto:jchilders@smartbusinessware.com]
Sent: Friday, February 14, 2003 3:43 PM
To: 'wxPython-users@lists.wxwindows.org'
Subject: [wxPython-users] wxMaskedTextCtrl v0.0.5Whew.. Here is rev 0.0.5 of the masked (or formatted) text
entry control.
The demo now requires two pages!Highlights:
1- Autoformat codes (demo'd on page 2) - basically, a bunch of common
formats and validations are built-in to the control.2- In-place validation. The control starts validating as soon
as the user
starts entering data into the control. It uses a visual cue
to tell them
when a valid entry has been completed. This is pretty cool, I
think. What
say you?3- For a laugh, have a look at the kludgy regex validation I
actually got to
work for dates and date/times (brute force technique). It
will prevent most
common keystroke errors but can still be fooled. Robin suggested using
wxDateTime's PARSE and I may either build this in just for
date types or I
might allow passing it as a validation function to the
control. Not sure
yet.4- Automatic self-sizing option.
5- Cursor movement and numeric fields have been improved.
Changelog follows. As always, feedback, criticism,
suggestions are welcome.Regards,
Jeff Childers
jchilders_98@yahoo.comPs- should I be zipping this file up? Does it's size bug anyone?
<<wxMaskedTextCtrl005.py>>
## CHANGELOG:
## ====================
## Version 0.0.5
## 1. get_plainValue method renamed to GetPlainValue following the
wxWindows
## StudlyCaps(tm) standard (thanks Paul Moore).
##
## 2. New format code 'F' causes the control to auto-fit (auto-size)
itself
## based on the length of the mask template.
##
## 3. Class now supports "autoformat" codes. These can be
passed to the
class
## on instantiation using the parameter
autoformat="code". If the code
is in
## the dictionary, it will self set the mask, formatting, and
validation string.
## I have included a number of samples, but I am hoping
that someone
out there
## can help me to define a whole bunch more.
##
## 4. I have added a second page to the demo (as well as a
second demo
class, test2)
## to showcase how autoformats work. The way they self-format and
self-size is,
## I must say, pretty cool.
##
## 5. Comments added and some internal cosmetic revisions
re: matching the
code
## standards for class submission.
##
## 6. Regex validation is now done in real time - field turns yellow
immediately
## and stays yellow until the entered value is valid
##
## 7. Cursor now skips over template characters in a more
intuitive way
(before the
## next keypress).
##
## 8. Change, Keypress and LostFocus methods added for
convenience of
subclasses.
## Developer may use these methods which will be called
after EVT_TEXT,
EVT_CHAR,
## and EVT_KILL_FOCUS, respectively.
##
## 9. Decimal and numeric handlers have been rewritten and
now work more
intuitively.
##
##############################################################
##############
#