Page 1 of 1

Current time - possible wrong value bug

PostPosted: 17 Apr 2017 19:24
by yocko
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

Re: Current time - possible wrong value bug

PostPosted: 19 Apr 2017 14:23
by Alexander Bulei
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.

Re: Current time - possible wrong value bug

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

Re: Current time - possible wrong value bug

PostPosted: 20 Apr 2017 10:13
by Alexander Bulei
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.

Re: Current time - possible wrong value bug

PostPosted: 21 Apr 2017 10:12
by yocko
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.

Re: Current time - possible wrong value bug

PostPosted: 21 Apr 2017 12:08
by Alexander Bulei
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.

Re: Current time - possible wrong value bug

PostPosted: 21 Apr 2017 14:30
by Alexander Bulei
Hello again,

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

Best Regards.

Re: Current time - possible wrong value bug

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

Re: Current time - possible wrong value bug

PostPosted: 26 Apr 2017 15:51
by Alexander Bulei
Hi yocko,

Fixed the issues with events and OnlyTimePicker property.

Available since 3.0.0.218.

Best Regards.

Re: Current time - possible wrong value bug

PostPosted: 26 Apr 2017 18:30
by yocko
Great!

You are very responsive :D