Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


TDateTimePicker Delphi 7 - BUG using XPManifest

Posted on 2004-08-13
Medium Priority
Last Modified: 2007-12-19
Hi Chaps,

I've found a very bad problem with the TDateTimePicker that I think borland should know about (don't know how to report it).

(Using Delphi 7 and Windows XP)

Try the following.

- Create a new application.
- On the form place the following...
- 1 dateTimePicker
- 2 Buttons
- 1 Edit Box
- 1 XP Manifect Component

Now create the following events.

- OnFormCreate
- Button1Click
- Button2Click
- DateTimePicker1Exit

Place in the following code...

procedure TForm1.DateTimePicker1Exit(Sender: TObject);
      Edit1.Text := DateToStr(DateTimePicker1.DateTime);

procedure TForm1.Button1Click(Sender: TObject);
   DateTimePicker1.DateTime := StrToDate('02/01/2004');

procedure TForm1.FormCreate(Sender: TObject);
      DateTimePicker1.DateTime := StrToDate('02/01/2004');

procedure TForm1.Button2Click(Sender: TObject);

Ok, here is the problem.  The DateTimePicker does not seem to fire it's internal change event sometimes when using the XP skin.

Example 1.

- Run the application
- Click Button 1
- (Edit1's text will say '02/01/2004') ......{or whatever regional format you have set up}
- Click in the datetimepicker on the first digit and press the down arrow key to change it to '01/01/2004'
- Click Button 1
- (Edit1's text will say '01/01/2004')
- Click in the datetimepicker on the first digit and press the down arrow key to change it to '01/01/2004' (again)
- Click Button 2 this time (button 2 has no code and it's only used to demonstrate loosing focus from the datetimepicker)

- Edit 1's text will now say 02/01/2004 when the date is actually saying 01/01/2004, which is obvisouly very wrong.

Example 2.

- Run the application
- Click the down arrown on the DTPicker.
- Click the red today box
- (DTPicker changes to show todays date)
- Click button 1
- (DTPicker changes to show '02/01/2004')
- Click the down arrown on the DTPicker.
- Click the red today box

- DTPicker STILL says 02/01/2004

Again this is obvisouly wrong.

If you take off the XPManifest control and remove XPMan from the uses at the top of the unit the control works fine!!

The question :

Does anyone have any code that fixes these bugs and does borland know about them?


In ComCtrls we found that changing the top part of the CNNotify of the DTPicker control to the following fixes my 'Example 2' bug but we don't have a fix for 'Example 1' yet.

- code fix for example 2.

procedure TDateTimePicker.CNNotify(var Message: TWMNotify);
  DT: TDateTime;
  AllowChange: Boolean;
  ST: TSystemTime;
  with Message, NMHdr^ do
    Result := 0;
    case code of
          FDroppedDown := False;

          DateTime_GetSystemTime(Handle, ST);
          DT := SystemTimeToDateTime(st);
          if Kind = dtkDate then
          if FShowCheckbox then FChecked := True;

          if Assigned(FOnCloseUp) then FOnCloseUp(Self);


Many Thanks
Question by:WoodyJ007
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 12

Expert Comment

ID: 11797803
Can be downloaded this TXPManifest for free ?

Author Comment

ID: 11807515
XPManifest is a standard borland component in Delphi 7.  It's under the Win32 tab.

Accepted Solution

modulo earned 0 total points
ID: 13404432
PAQed with points refunded (500)

Community Support Moderator

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question