Hello Everyone,
I really like the DTPicker control, but in my application I allow dates to be entered without formatting (as a simple string with a TGet()). I have validation code which normalizes the date string and tells the user if there is a problem with the date when focus is shifted away. This is the way QuickBooks handles dates, and allows for quick entry without getting "hung up" on the slashes. For example you could enter:
1 2 6
...for January 2, 2006 with or without the slashes. And since the whole date string is highlighted when the control receives focus, blanking out a date is as simple as pressing the space bar and the tab key.
Does anyone know a way to turn off the date validation and slash (/) formatting in a TDatePick object, while keeping the pop-up calendar functionality?
Thanks!
-Patrick
DTPicker without forced date formatting
- PatrickWeisser
- Posts: 53
- Joined: Fri Mar 23, 2007 4:10 am
- Location: Seattle, WA, USA
- Contact:
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
-
- Posts: 466
- Joined: Sun Oct 30, 2005 6:37 am
- Location: Guangzhou(Canton),China
- Contact:
- PatrickWeisser
- Posts: 53
- Joined: Fri Mar 23, 2007 4:10 am
- Location: Seattle, WA, USA
- Contact:
Thanks James. I think what I might try doing is to size the DTPicker control down so that only the down-arrow shows to activate the calendar, and I will place it right next to the text control I'll be using for the date string. If the user types a date, the VALID clause in the text control will do my custom validation to normalize and validate the string, then call the SetDate() method of the DTPicker control to update it with the CtoD() of the text control. Likewise, if the user clicks on the DTPicker down-arrow and selects a date, I will have a code block set for the "On Change" clause of the DTPicker control that will set my text control to the DtoC() of what's in the DTPicker control.
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Patrick,
Sounds like a good solution. Let us know how it works out.
I am a big fan of allowing data input like you are doing, and post processing it into the proper format. Anything to make life easier for the user.
Other date tricks I have tried are "t" for tommorow, "w" for one week from today, "m" for one month from today, "9d" for 9 days from today, etc. There are all kinds of shortcuts you can provide.
Regards,
James
Sounds like a good solution. Let us know how it works out.
I am a big fan of allowing data input like you are doing, and post processing it into the proper format. Anything to make life easier for the user.
Other date tricks I have tried are "t" for tommorow, "w" for one week from today, "m" for one month from today, "9d" for 9 days from today, etc. There are all kinds of shortcuts you can provide.
Regards,
James