DateTimePicker fires DateChanged event when changing month

Target Windows on Xojo 2020r2.1
Is there a way to stop the datetimepicker from firing the Datechanged event when moving from month to month. I am filling a ListBox when the Date changes but I only want to fill it when the day is selected.
Edit: Forgot to mention this occurs in the Date graphical view.
Thanks

I haven’t tried it yet. Does the SelectedDate also change? If not, the easiest solution is to create a subclass that intercepts that event and tracks the last SelectedDate. It will only re-raise the event to you when the date truly changes.

File a bug report. Walking thru dates and not selecting them should not fire a change or modify the content being edited, before such selection.

1 Like

I just tried it and the SelectedDate does change when moving from month to month.

I will check in Feedback and see if a bug report has been filed.
Thanks Rick

1 Like

That’s a bummer.

Feedback case filed case 64136

1 Like

This renders the control useless, people will change some dates in some forms without noticing causing data damages everywhere.

To make matters worse, The datechanged event fires twice every time.

I dont see that behaviour here when using the month changer (left < or right >).
Duplicate events happen if you click a day in the list, that’s clearly happening here too.
In the dateChanged event:

System.DebugLog CurrentMethodName + ", "+value.ToString

I get only 1 call even when i loose the focus of the control, i won’t get another event raised.

I do note that there is no GotFocus and LostFocus events that would be rather useful in this control.

Did you provide a sample privately? If not, please provide one (public or private), that will speed the review process.

No, just a new Control in it’s first Xojo Version. :wink:

It just confirms what we’ve seen with so many other new features. It takes a couple of Xojo versions until they’re ready.

And without being able to set it’s Font/Size, it just doesn’t fit properly in our UI :wink:
That’s <https://xojo.com/issue/62860>.

At least… Xojo should be aware of all that. We’ve all provided Feedback. It’s up to them to deliver - until then I’m just having to ignore that Control. I’d love to be surprised with a full-featured and useable Control in an upcoming release.

2 Likes

@derkj It is clearly happening in my app. I just added your debug log code to the dateChanged event and it logged it when I moved to a previous month, without clicking anything else. No other code is in the datechanged event. I tried it with the control on a window and in container. Xojo 2020r2.1 on Windows.
For the duplicate event firing, I call a timer which calls my method. The timer stops the event from firing twice.

@AlbertoD I did not not provide a sample project but I will go and add one now.
Thanks

1 Like

Consider building that into a subclass.

When Gary reported it, I’ve saw exactly what he reported In 2020r2.1 in a simple test.

@Kem_Tekinay I subclassed it but not sure what to do next. Any help would be appreciated.
Thanks

There’s not enough exposed properties and events to detect the involved states to properly workaround the bugs. The control needs Xojo intervention urgently.

In the subclass, implement the DateChanged event and have it start a Timer built into the subclass, RunMode = Single. That Timer will Raise your own DateChanged event to the subclasses, so as far as your subclasses are concerned, the event only fires once.

The same issue is there with Einhugur date control. When i contacted he said he don’t have any solution for it. So may be its an issue from the windows date control itself.

1 Like