Frank,
this code from Roberto Chiaiese may help you:
For those who are interested:
Using the class TDatePicker is possible to return an empty date only
using the DTS_SHOWNONE style.
Unchecking the flag it will return the empty date.
But if you pass an empty date as starting value then the datepicker
shows the today date and the checkbox is ON.
In this way if you have an editing window with a datepicker the user can
modify an empty date to today date without being aware of it.
below is the solution I found:
(using FWH 2.5)
#define DTS_SHOWNONE 2 // r.c. add: 05/09/2005
#define DTM_FIRST 0x1000 //
#define DTM_GETSYSTEMTIME (DTM_FIRST + 1) //
#define DTM_SETSYSTEMTIME (DTM_FIRST + 2) //
#define GDT_VALID 0 //
#define GDT_NONE 1 //
/ r.c. mod: 05/09/2005
METHOD SetDate( dDate ) INLINE SetDatePick( ::hWnd, Year( dDate ),;
Month( dDate ), Day( dDate ) )
/
METHOD SetDate( dDate ) INLINE if( empty(dDate), ::SetNull(),;
SetDatePick( ::hWnd, Year( dDate ), Month( dDate ),;
Day( dDate )) )
METHOD SetNull() INLINE SendMessage(::hWnd,;
DTM_SETSYSTEMTIME, GDT_NONE )
(don't forget the following in the new() method:)
// r.c. add: DTS_SHOWNONE
::nStyle = nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP,;
DTS_SHOWNONE,;
If( lDesign, WS_CLIPSIBLINGS, 0 ) )
best regards
Stefan