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

How to Remove the "Today" Mark from the TDateTimePicker

By , About.com Guide

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

Explore Delphi Programming
About.com Special Features

Reader's Choice Award Winners

What are the best instant messengers, apps, editors and more? You told us, for our 2010 technology awards program. More >

iPad Central

Is Apple's new tablet computer impractical, a must-have -- or both? We'll help you figure it out. More >

  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

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

All rights reserved.