1. Home
  2. Computing & Technology
  3. Delphi Programming

How to Remove the "Today" Mark from the TDateTimePicker

By Zarko Gajic, About.com

The TDateTimePicker component displays a list box for entering dates or times. By design it displays the label "today" at the bottom of the control allowing a user to quickly select the today's date.

Here's how to remove the "today" marker from the TDateTimePicker. Handle the OnDropDown event as:

uses CommCtrl, ...

procedure TForm1.DateTimePicker1DropDown(Sender: TObject) ;
var
   wnd: HWND;
   style: Integer;
begin
   wnd := DateTime_GetMonthCal(DateTimePicker1.Handle) ;
   if wnd <> 0 then
   begin
     style := GetWindowLong(wnd, GWL_STYLE) ;
     SetWindowLong(wnd, GWL_STYLE, style or MCS_NOTODAY or MCS_NOTODAYCIRCLE) ;
   end;
end;
Note: Here's how to show week numbers in a TDateTimePicker.

Delphi tips navigator:
» How to Detect a TPopupMenu's OnClose (OnPopDown) Event
« How to Clone a Delphi Form

More Delphi Programming Quick Tips

Explore Delphi Programming

More from About.com

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. Delphi 2006 Tips
  7. How to Remove the "Today" Mark from the TDateTimePicker Delphi component

©2008 About.com, a part of The New York Times Company.

All rights reserved.