Jump to content
Andrew Spencer

TCalendarView returning a bad Date

Recommended Posts

A TCalendarView on a TForm, with a TMemo. In the TCalendarView's OnClick event, add a line to the TMemo showing when the OnClick event happened, and the formatted and integer value of TCalendarView.Date.

image.thumb.png.a2477942001cdf7fb231305dade619b0.png

 

In Delphi 10.4.2 I am seeing that with consecutive <1Hz clicking on the same date, a "bad" date value is returned on every second click returns a null date. Also, when clicking >~1Hz, this can produce multiple "bad" dates.

 

The "bad" date value is -700000 (if you take the Trunc() of it).

 

Does anyone have any ideas?

TCalendarViewBadDate.zip

Edited by Andrew Spencer

Share this post


Link to post

I'm a bit unsure what your example should achieve, as it doesn't match what you show here.

Share this post


Link to post

I can confirm using both OnClick and OnChange events that I can receive:

45113
-700000
45113
-700000
45113
-700000
45113
-700000
45113
-700000
45113
-700000
45113
-700000
45113
-700000
45113
-700000
45113
-700000
45113
-700000
 

Share this post


Link to post

I guess, that is as designed. When you click on a date that date is selected. When you click again on the same date it is unselected and the Date property is set to NullDate:

  NullDate: TDate = -700000;

You can avoid that when you set SelectionMode to smNone.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×