Hi Joe,
0 filling will probably be difficult to work out
Well, I have a method __adjustDate that is called on each Char event when
the control is set to date-type. Right now, this handles auto-expanding the
year (type 67 in the year slot, it immediately expands to 1967). This method
could be instructed to do the following things:
- user types 2-9 as the first char in the 'month' position
==> replace with '0' + entryDigit and advance to next 'slot'
- user types 4-9 as the first char in the 'day' position
==> replace with '0' + entryDigit and advance to next 'slot'
- user types '(1|2)/' in the 'month' position:
==> replace with '0' + entryDigit and advance to the next
'slot'
- user types '(1|2|3)/' in the 'day' position:
==> replace with '0' + entryDigit and advance to the next
'slot'
The slash could be defined in a new class variable, say __dateSepChar or
something (actually _dateSepChar might be for the ','... but whatever) so it
could be flexible on delimiters (i.e. '/' or '.' or '-').
The question is, though, is this _too_ smart for its own good?
Might be a good time to stop what your doing and figure out how to assign
values the masked fields.
Currently you can use SetValue() to set the value. This requires you to have
mask characters embedded, of course. I plan for a SetPlainValue() method
that will take a value stripped of mask characters and embed them in the
format mask. The various 'adjust' methods will be called afterward to
'pretty up' the values provided (__adjustInt, __adjustDec, __adjustDate).
Does this sound right?
Regards,
Jeff Childers
jchilders_98@yahoo.com
···
-----Original Message-----
From: Joe Brown [mailto:joebrown@rclooke.com]
Sent: Monday, February 17, 2003 9:34 AM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] wxMaskedTextCtrl v0.0.5
I would show you the javascript I wrote to handle this, but after parusing
thru the masked edit code, I don't think it would be of use. The javascript
I developed was rudimentary.
Basically all it did: On invalid key pressed, check the next space's format
code, if it's a matching literal, advance insertion point. This leaves a
left justified number and a space in the entry, but thats easy to overcome
and makes sense to the operator.
It's not award winning logic, but works for the date application. It may
collide with other logic.
0 filling will probably be difficult to work out and I don't know if it's
prudent to implement such logic, it may not be what the operator would
expects.
Might be a good time to stop what your doing and figure out how to assign
values the masked fields. Frequently the use of these fields will be to
modify existing data. By the looks of it your concentrating only on input.
-joe
----- Original Message -----
From: "Jeff Childers" <jchilders@smartbusinessware.com>
To: "'Joe Brown'" <joebrown@rclooke.com>
Cc: <wxPython-users@lists.wxwindows.org>
Sent: Monday, February 17, 2003 8:27 AM
Subject: RE: [wxPython-users] wxMaskedTextCtrl v0.0.5
Hi Joe,
Thanks very much for the feedback. I've placed both your comments on the
wishlistRE: Percent
I was using a regex string to validate the percent. With rev 0.0.6, the
control now supports ranges so I'll change the autoformat for percent to
use
a range (0.00->1.00) instead. Thanks for the headsup!
RE: Navigate to mask characters (like '/'):
Yeah, sigh. I've taken a couple cracks at this and it's been messy so far.
But I may wake up one of these mornings with the answer already in my
head.
Hopefully!
Again, thanks for the feedback.
Regards,
Jeff Childers
jchilders_98@yahoo.com-----Original Message-----
From: Joe Brown [mailto:joebrown@rclooke.com]
Sent: Friday, February 14, 2003 7:21 PM
To: Jeff Childers
Subject: Re: [wxPython-users] wxMaskedTextCtrl v0.0.5Couple request for the controls:
Percent doesn't accept 100% or 1.00
when literals are present, specifically for date, the / literal when typed
should navigate the insertion point to the next section of entry. This
removes confusion when ppl type 1/1/99 for the date, but it's easier said
than done.-Joe
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org