DTPicker without forced date formatting

DTPicker without forced date formatting

Postby PatrickWeisser » Thu Oct 16, 2008 9:50 pm

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
User avatar
PatrickWeisser
 
Posts: 53
Joined: Fri Mar 23, 2007 4:10 am
Location: Seattle, WA, USA

Postby James Bott » Fri Oct 17, 2008 3:36 am

Patrick,

I think you would have to call the dtpicker control from another button. The dtpicker is returning a value in date format so you then have to convert it to string to place it in your GET.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby ShumingWang » Fri Oct 17, 2008 3:48 am

The better ,Datepicker intergrate into Tget class action clause,if this work could done by FWH .
Shuming Wang
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Postby PatrickWeisser » Fri Oct 17, 2008 5:34 am

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.
User avatar
PatrickWeisser
 
Posts: 53
Joined: Fri Mar 23, 2007 4:10 am
Location: Seattle, WA, USA

Postby James Bott » Fri Oct 17, 2008 5:32 pm

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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 48 guests