CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Problem displaying time, at the beginning

by Ricardo Muñoz » 10 Mar 2016 23:13

Hi,

I'm using DateTimePicker to set Time only (I can not use TimePicker because I need seconds to set the time). This code is in the creation of a frame:

Code: Select all
  DateTimePicker1.OnlyTimePicker := True;
  DateTimePicker1.JQTimeCustomLocal.TimeFormat := 'HH:mm:ss';
  DateTimePicker1.DateTime := EncodeTime(0,0,0,0);

  DateTimePicker2.OnlyTimePicker := True;
  DateTimePicker2.JQTimeCustomLocal.TimeFormat := 'HH:mm:ss';
  DateTimePicker2.DateTime := EncodeTime(23,59,59,0);


The first time the page are displayed DateTimePicker1 show nothing, I expected to show 00:00:00, and worse, DateTimePicker2 show 12/30/1899, I expected to show 23:59:59. Is there a way to solve these problems?

TIA,
Ricardo
Ricardo Muñoz
 
Posts: 28
Joined: 25 Feb 2016 23:42

by Alexander Bulei » 11 Mar 2016 10:35

Hi Ricardo Muñoz ,

Is there a way to solve these problems?


Note, the DateTime property is TDateTime class, so the setter, expect the valid value.

Code: Select all
DateTimePicker1.DateTime := EncodeTime(0,0,0,0);
DateTimePicker2.DateTime := EncodeTime(23,59,59,0);


This is incorrect code...
Try your code in Win32 application with TDateTimePicker component, and you will see the same result.

Use EncodeDateTime instead EncodeTime/EncodeDate.

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by Ricardo Muñoz » 11 Mar 2016 16:45

Hi,

Using EncodeDateTime(1,1,1,0,0,0,0) and EncodeDateTime(1,1,1,23,59,59,0) cause the same problem, it show nothing in the first case and a date in the second.

Win32 TDateTimePicker doesn't have the problem, If I set Format to HH:mm:ss, the first case it show 00:00:00 and 23:59:59 in the second, independent of the date set. While CGJQDateTimePicker with OnlyTimePicker := True, the first time the component is rendered, when you set the time to 00:00:00 it doesn't show and when you set the time to 23:59:59 it shows a date, although it should only show time because OnlyTimePicker := True.

I think it's a bug. Because if I set the time using the window (or panel) to set the time, it shows 00:00:00 and 23:59:59 without date. But the first time this component is rendered it doesn't show the correct values.

TIA,
Ricardo
Ricardo Muñoz
 
Posts: 28
Joined: 25 Feb 2016 23:42

by Alexander Bulei » 11 Mar 2016 17:39

Hi Ricardo,

I think it's a bug. Because if I set the time using the window (or panel) to set the time, it shows 00:00:00 and 23:59:59 without date. But the first time this component is rendered it doesn't show the correct values.


Thanks for reporting.
We will check what is going on...

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by Alexander Bulei » 11 Mar 2016 18:47

Hi Ricardo,

Fixed in next beta release.
Thanks.

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by Ricardo Muñoz » 26 Apr 2016 22:57

Hi,

I'm testing this in versión 2.9.0.244. It was corrected the problem the first time it's displayed. But the problem persist when the value of DateTime is changed by code on an event.

Create the form
Code: Select all
  DateTimePicker1.OnlyTimePicker := True;
  DateTimePicker1.JQTimeCustomLocal.TimeFormat := 'HH:mm:ss';
  DateTimePicker1.DateTime := EncodeTime(0,0,0,0);


On a button click event
Code: Select all
  // StartTime Field has the start time in seconds
  DateTimePicker1.DateTime := Database.FieldByName('StartTime').AsInteger / 86400.0;


After press the button, DateTimePicker1 show date and time if StartTime > 0 and show nothing if is equal to 0.

TIA,
Ricardo
Ricardo Muñoz
 
Posts: 28
Joined: 25 Feb 2016 23:42

by Ricardo Muñoz » 06 May 2016 03:26

Hello,

What about the problem mentionated in the previous post?

TIA,
Ricardo
Ricardo Muñoz
 
Posts: 28
Joined: 25 Feb 2016 23:42

by Alexander Bulei » 06 May 2016 10:19

Hi Ricardo Muñoz,

Sorry about the delay...
It's fixed on next beta build.

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by Ricardo Muñoz » 06 May 2016 16:14

Ok. No problem. Thanks a lot.

Ricardo
Ricardo Muñoz
 
Posts: 28
Joined: 25 Feb 2016 23:42


Return to JQDateTimePicker

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.