View Issue Details

IDProjectCategoryView StatusLast Update
0005840JEDI VCL00 JVCL Componentspublic2012-09-10 14:15
ReporterZENsanAssigned Toobones 
PrioritynormalSeverityblockReproducibilityalways
Status resolvedResolutionfixed 
PlatformWindowsOSWindows 7 64OS Version
Product Version 
Target VersionFixed in Version3.46 
Summary0005840: When TJvDBDateTimePicker is set to Kind = dkTime it works incorrectly.
DescriptionWhen TJvDBDateTimePicker is set to Kind = dkTime it works incorrectly.
First you get an exception when you try to set time to 0:00 and then second problem is that if you set NullText then you are not able to edit the value in editor at all.
Can be related also to 0004332.
Steps To Reproduce1) Run attached application;
2) Press up and then down on the first editor, you will get exception "You must be in ShowCheckbox mode to set to this date.";
3) Now try to modify the second editor - you will be not able to, but must.
TagsNo tags attached.

Activities

2012-03-22 11:47

 

JvDBDateTimePicker.zip (1,360 bytes)

2012-03-29 10:26

 

JvDateTimePicker.diff (570 bytes)
--- C:/Program Files (x86)/Embarcadero/RAD Studio/7.0/lib/jvcl/run/JvDateTimePicker.pas	�� �� 10 15:47:26 2011
+++ C:/Users/hohlovm/Documents/RAD Studio/Projects/JVDBDateTimePicker/JvDateTimePicker.pas	�� ��� 29 11:00:48 2012
@@ -152,10 +152,8 @@
 end;
 
 function TJvDateTimePicker.WithinDelta(Val1, Val2: TDateTime): Boolean;
-const
-  cOneSecond = 1 / 86400;
 begin
-  Result := Abs(Frac(Val1) - Frac(Val2)) <= cOneSecond;
+  Result := Abs(Frac(Val1) - Frac(Val2)) < EncodeTime(0, 0, 1, 0);
 end;
 
 function TJvDateTimePicker.CheckNullValue: Boolean;
JvDateTimePicker.diff (570 bytes)

2012-03-29 10:26

 

JvDBDateTimePicker.diff (1,560 bytes)
--- C:/Program Files (x86)/Embarcadero/RAD Studio/7.0/lib/jvcl/run/JvDBDateTimePicker.pas	�� �� 10 15:47:26 2011
+++ C:/Users/hohlovm/Documents/RAD Studio/Projects/JVDBDateTimePicker/JvDBDateTimePicker.pas	�� ��� 29 11:25:08 2012
@@ -1,4 +1,4 @@
-{-----------------------------------------------------------------------------
+{-----------------------------------------------------------------------------
 The contents of this file are subject to the Mozilla Public License
 Version 1.1 (the "License"); you may not use this file except in compliance
 with the License. You may obtain a copy of the License at
@@ -573,17 +573,29 @@
 procedure TJvDBDateTimePicker.CNNotify(var Msg: TWMNotify);
 var
   st: TSystemTime;
+  DtInfo: ^tagNMDATETIMECHANGE;
+  MsgRaw: TMessage absolute Msg;
 begin
   case Msg.NMHdr^.code of
     DTN_DATETIMECHANGE:
     begin
       FDataLink.Edit;
       if FIsReadOnly and not FDataLink.CanModify then
-      begin
-        DateTimeToSystemTime(DateTime, st);
-        MsgSetDateTime(st);
-        Exit;
-      end;
+        begin
+          DateTimeToSystemTime(DateTime, st);
+          MsgSetDateTime(st);
+          Exit;
+        end
+      else if Kind = dtkTime then
+        begin
+          { Get the information about change }
+          if Field <> nil then
+            begin
+              DtInfo := Pointer(MsgRaw.LParam);
+              Field.Value := SystemTimeToDateTime(DtInfo.st);
+            end;
+          Exit;
+        end;
     end;
   end;
   inherited;
JvDBDateTimePicker.diff (1,560 bytes)

ZENsan

2012-03-29 10:28

reporter   ~0019683

In the original project there was one bug more!
If you set the field to value of 1 second. Then second control (with nulltext) still displayed null text instead of 1 second.

Attached patches fixes exception issue and second precion issue, but that one with NullText which cannot be changed afterwards are still unsolved in my patch.

obones

2012-06-12 13:33

administrator   ~0019910

This is now in SVN

Issue History

Date Modified Username Field Change
2012-03-22 11:47 ZENsan New Issue
2012-03-22 11:47 ZENsan File Added: JvDBDateTimePicker.zip
2012-03-26 15:25 obones Status new => acknowledged
2012-03-29 10:26 ZENsan File Added: JvDateTimePicker.diff
2012-03-29 10:26 ZENsan File Added: JvDBDateTimePicker.diff
2012-03-29 10:28 ZENsan Note Added: 0019683
2012-06-12 13:33 obones Note Added: 0019910
2012-06-12 13:33 obones Status acknowledged => resolved
2012-06-12 13:33 obones Fixed in Version => Daily / SVN
2012-06-12 13:33 obones Resolution open => fixed
2012-06-12 13:33 obones Assigned To => obones
2012-09-10 14:15 obones Fixed in Version Daily / SVN => 3.46