How to make a TDateTimePicker display blank
< Continued from page 1
A little trick is to use the letters gg in the format property. This format pattern displays the period or era. This pattern is ignored if the date to be formatted does not have an associated period or era string - which TDateTimePicker does not - thus the display is blank. When a date is subsequently selected you can then set the format to '' in the OnChange or OnClick event handler in order to get it to display again.
The format property was added in Delphi 6. In earler versions add CommCtrl to the uses clause of your unit and use the following code:
~~~~~~~~~~~~~~~~~~~~~~~~~
DateTime_SetFormat(DateTimePicker1.Handle, 'gg') ;
~~~~~~~~~~~~~~~~~~~~~~~~~
Delphi tips navigator:
» How to add a button to the IE Toolbar?
« Change the default directory Delphi uses to save projects
A little trick is to use the letters gg in the format property. This format pattern displays the period or era. This pattern is ignored if the date to be formatted does not have an associated period or era string - which TDateTimePicker does not - thus the display is blank. When a date is subsequently selected you can then set the format to '' in the OnChange or OnClick event handler in order to get it to display again.
The format property was added in Delphi 6. In earler versions add CommCtrl to the uses clause of your unit and use the following code:
~~~~~~~~~~~~~~~~~~~~~~~~~
DateTime_SetFormat(DateTimePicker1.Handle, 'gg') ;
~~~~~~~~~~~~~~~~~~~~~~~~~
Delphi tips navigator:
» How to add a button to the IE Toolbar?
« Change the default directory Delphi uses to save projects
Source...