CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Current time - possible wrong value bug

by yocko » 17 Apr 2017 19:24

Hi

testing your cgDateTimePicker. I have three questions.


#1
My test settings:

WCGJQDateTimePicker1.JQTimePickerOptions.HourMin:=10;
WCGJQDateTimePicker1.JQTimePickerOptions.HourMax:=17;
WCGJQDateTimePicker1.JQTimePickerOptions.ShowButtonPanel:=True;
WCGJQDateTimePicker1.OnlyTimePicker:=True;

When dialog is first time visible value in dialog is 10:00. Let's say current time in my country is 19:45. If I now click on button "Now" in WCGJQDateTimePicker's dialog value in DateTimePicker will be 10:45 --> hour is wrong.

If current time is outside of HourMin/HourMax range nothing should be entered or error should inform user current time is outside of allowed time range.

#2
WCGJQDateTimePicker1.JQTimePickerOptions.ShowButtonPanel:=True

I want to have button panel visible, but I don't want to show current time button. Is that possible?


#3
How can I prevent user to enter time manually using keyboard? Because using keyboard user can enter wrong time (not valid format). I want to force him/her to use only dialog for changing the time.

Thanks in advance for your response.

Best regards
yocko
 
Posts: 28
Joined: 12 Mar 2017 19:27

by Alexander Bulei » 19 Apr 2017 14:23

Hi yocko,

#1
My test settings:

WCGJQDateTimePicker1.JQTimePickerOptions.HourMin:=10;
WCGJQDateTimePicker1.JQTimePickerOptions.HourMax:=17;
WCGJQDateTimePicker1.JQTimePickerOptions.ShowButtonPanel:=True;
WCGJQDateTimePicker1.OnlyTimePicker:=True;

When dialog is first time visible value in dialog is 10:00. Let's say current time in my country is 19:45. If I now click on button "Now" in WCGJQDateTimePicker's dialog value in DateTimePicker will be 10:45 --> hour is wrong.

If current time is outside of HourMin/HourMax range nothing should be entered or error should inform user current time is outside of allowed time range.


It's a default behavior of plugin, "cut" the time to max/min value...
We can't change that.

#2
WCGJQDateTimePicker1.JQTimePickerOptions.ShowButtonPanel:=True

I want to have button panel visible, but I don't want to show current time button. Is that possible?


I've implemented new property in JQDatePickerOptions.CurrentBtn - show/hide the Today/Current button.
Will be available in next beta build.

#3
How can I prevent user to enter time manually using keyboard? Because using keyboard user can enter wrong time (not valid format). I want to force him/her to use only dialog for changing the time.


Please set the control to ReadOnly, and set JQDatePickerOptions.ShowPopUpOnReadOnly to True.

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 yocko » 19 Apr 2017 20:59

Thanks for your tips. All were very valuable. :D

I have additional questions/problems.

#1
How can I know when user select time?

I added code to Close and Select event, but none of them fired!??? :o
Code: Select all
procedure TIWForm1.IWCGJQDateTimePicker1JQDatePickerOptionsClose(
  Sender: TObject; AParams: TStringList);
begin
  WebApplication.ShowMessage('OnClose');
end;

procedure TIWForm1.IWCGJQDateTimePicker1JQDatePickerOptionsSelect(
  Sender: TObject; AParams: TStringList);
begin
  WebApplication.ShowMessage('OnSelect');
end;


Now I am totally confused :? Please advice. I don't see any other suitable event to react on new value (time) user entered (using your dialog/no keyboard input)... I tried to change value also with keyboard, but same thing: select/close events don't fire.

Please see my DateTimePicker settings in my first post. I am trying to collect data for time only...


#2
I tried to use IWCGJQTimePicker instead of IWCGJQDateTimePicker, but there I can't prevent time change with keyboad (possible wrong value can be entered). Your suggested trick for DateTimePicker with readonly can't be used with TimePicker as TimePicker doesn't have property ShowPopupOnReadOnly. Maybe it is a good idea :idea: to add such property to TimePicker too to be coherent with DateTimePicker

Is there any other way to prevent changing IWCGJQTimePicker's time value with keyboard?


Again, thanks in advance for your feed back.

Kind regards
yocko
 
Posts: 28
Joined: 12 Mar 2017 19:27

by Alexander Bulei » 20 Apr 2017 10:13

Hi yocko,

How can I know when user select time?I added code to Close and Select event, but none of them fired!???


I have checked here, and they work as expected.
Try to check this: https://www.cgdevtools.com/cgforum/viewtopic.php?f=5&t=1366

Is there any other way to prevent changing IWCGJQTimePicker's time value with keyboard?


Unfortunately, its controlled by plugin, and have validation to NOT show the popup when ReadOnly.

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 yocko » 21 Apr 2017 10:12

Alexander Bulei wrote:Hi yocko,

yocko wrote:How can I know when user select time?I added code to Close and Select event, but none of them fired!???


I have checked here, and they work as expected.


I can reproduce that every time when property OnlyTimePicker in design time is set to true! Please test it with
Code: Select all
OnlyTimePicker:=true


I suppose property OnlyTimePicker is there to work only with time and user don't see date part. That is why I set it to True. But then close and select event don't fire.


Alexander Bulei wrote:Try to check this: https://www.cgdevtools.com/cgforum/viewtopic.php?f=5&t=1366


All from that link is OK and checked as all other things works normally...

Best regards and have a nice weekend.
yocko
 
Posts: 28
Joined: 12 Mar 2017 19:27

by Alexander Bulei » 21 Apr 2017 12:08

Hi yocko,

every time when property OnlyTimePicker in design time is set to true


I miss that property...I will re-check it asap.
Thank you.
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 » 21 Apr 2017 14:30

Hello again,

Ok, please use the JQDatePickerOptions.TimeOnly property for this purpose.

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 yocko » 21 Apr 2017 16:20

Alexander Bulei wrote:Ok, please use the JQDatePickerOptions.TimeOnly property for this purpose.


If I do so events (select, close) are working, but DateTimePicker behaviour is odd. :shock:

#1
I always see date part but I want just time part.

My TimePickerOptions settings:
OnlyTimePicker:=False --> if true events OnClose, OnSelect don't fire
TimeOnly:=True
TimeOnlyShowDate:=False; --> but I still see date part !!!

#2
DateTimePicker has some DateTime value visible while control is not not active (on video bellow we see 21.4.2017 16:53). This vaue for example is assigned from database or on form create. BUT when I click in DateTimePicker to show dialog to change time, it shows

hour: 00
minute: 00

although DateTimePicker has some valid value like 21.4.2017 16:53.

Why dialog to change time doesn't show correct value like:

hour: 16
minute: 53

So my questions are:

#1
How to show only time part in control (and events OnClose, OnSelect should work)? I can't find any combination of settings to solve that puzzle. If showing time in dialog is correct (OnlyTimePicker:=True), then events don't fire and vice versa.

#2
Why time change dialog (when is visible) doesn't reflect correct value from DateTimePicker and show me 00 (Hour) and 00 (Minute) instead?

Please see this behaviour in video bellow (animated gif). Click on last link if img tag won't display it well...

Thanks in advance for your reponse.

Image

https://anonimag.es/i/DateTimePickerProblems5bf68.gif
yocko
 
Posts: 28
Joined: 12 Mar 2017 19:27

by Alexander Bulei » 26 Apr 2017 15:51

Hi yocko,

Fixed the issues with events and OnlyTimePicker property.

Available since 3.0.0.218.

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 yocko » 26 Apr 2017 18:30

Great!

You are very responsive :D
yocko
 
Posts: 28
Joined: 12 Mar 2017 19:27


Return to JQDateTimePicker

cron

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.