Solved

TDateTimePicker Delphi 7 - BUG using XPManifest

Posted on 2004-08-13
5
1,337 Views
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);
begin
      Edit1.Text := DateToStr(DateTimePicker1.DateTime);
end;

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

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

procedure TForm1.Button2Click(Sender: TObject);
begin
      //
end;


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);
var
  DT: TDateTime;
  AllowChange: Boolean;
  ST: TSystemTime;
begin
  with Message, NMHdr^ do
  begin
    Result := 0;
    case code of
      DTN_CLOSEUP:
        begin
          FDroppedDown := False;
          //SetDate(SystemTimeToDateTime(FLastChange));

          //**
          DateTime_GetSystemTime(Handle, ST);
          DT := SystemTimeToDateTime(st);
          if Kind = dtkDate then
            SetDate(DT)
          else
            SetTime(DT);
          if FShowCheckbox then FChecked := True;
          Change;
          //**

          if Assigned(FOnCloseUp) then FOnCloseUp(Self);
        end;
      DTN_DATETIMECHANGE:
        begin

etc...


Many Thanks
Woody
0
Comment
Question by:WoodyJ007
5 Comments
 
LVL 12

Expert Comment

by:esoftbg
ID: 11797803
Can be downloaded this TXPManifest for free ?
0
 

Author Comment

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

Accepted Solution

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

modulo
Community Support Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
loading dll from external path 1 211
Mydac connection data base issue 3 139
FMX StringGrid1->Canvas->FillRect Problem 3 127
Delphi IDE crash without error message ... 7 76
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

910 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now