[DUG] A good time picker???

Paul Heinz paul at accredo.co.nz
Tue May 23 14:36:24 NZST 2006


John Bird wrote:
> I would also be interested in this.....I have tended to just use
> edit boxes mainly cos the standard VCL doesn't allow easy keyboard entry.
I
> do have a couple of date conversion routines, eg for verifying that a
string is a
> valid date, and converting such a string into a TDateTime and to a numeric
> date (Integer in format YYYYMMDD).  It accepts dates in a very flexible
> form, eg for 1 Feb 2006 it accepts any of
>
> 1.2.06
> 1/2/06
> 1.2.2006
> 1-feb-06
> 1 feb 2006
>
> etc - and reformats the date input to a standardised format the programmer
> chooses
>
> Main thing it doesn't do is american dates (sorry to any yanks out there)

Heh :-) Snap! I wrote a similar routine which takes into account your
Windows Regional settings (so it can do Yank if you happen to be in
Yankyland :-) and also takes a default (or current) date parameter so you
can type things like:

'20' to change to the 20th of the current month or
'.Feb' to change to the same day of February or
'//2005' to change years, etc.

<rant>
I hate masked edit style date controls - actually, make that masked edits in
general which fall into the 'make the user jump through hoops to do what's
convenient for the computer (or usually the developer)' category.

IMO, it's cool for users to have a control which formats dates and/or IRD
no's (i.e. the ususal maskedit culprits) nicely and standardly. Just don't
make them type it in that way and have to remember whether this mask edit
implementation auto skips the seperators or if you have to type them and how
to get to the next section if you want to and ...
</rant>

Phew! Good to get that out of my system :-)

TTFN,
  Paul.





More information about the Delphi mailing list