View Issue Details

IDProjectCategoryView StatusLast Update
0029617LazarusLCLpublic2016-02-22 00:54
ReporterPeter Page Assigned ToZoran Vučenović  
Status resolvedResolutionno change required 
PlatformIntel Core i7-4790OSWindows 
Product Version1.4.4 
Summary0029617: TDateTimePicker – can’t pick date when year is changed
DescriptionIf the user changes the year (by clicking on the name of the month at the top of the component) and then selects a month, the DateTimePicker closes before the day of the month can be selected. The DateTimePicker must then be opened a second time to select a date. The TCalendarDialog performs this task correctly.
Steps To Reproduce1. Click on the date at the top of the component to select a different
   month or year (don't use the navigation arrows; that won't cause
   the error).

2. Select the month.

3. Select the date of the month.

This works properly with the TCalendarDialog component but the DateTimePicker component closes after step 2. It must be reopened to change the date of the month.
TagsNo tags attached.
Fixed in Revision
Attached Files


related to 0029646 closedBart Broersma Lazarus TCalendar.HitTest method incorectly returns cpDate 
has duplicate 0029696 resolvedZoran Vučenović Lazarus CCR TDatetimePicker and TDBDatetimePicker prematurely leaves calendar after selecting a year 


Peter Page

2016-02-07 21:44

reporter (375,472 bytes)

Bart Broersma

2016-02-08 16:05

developer   ~0089854

I would think the culprit is

TCalendarControlWrapper.AreCoordinatesOnDate(X, Y: Integer): Boolean;

It is called in MoueUp of the calendar form.
If it returns True the calendar form is closed.

Zoran Vučenović

2016-02-13 15:18

developer   ~0089988

Last edited: 2016-02-13 15:18

View 2 revisions

It is not a problem in TDateTimePicker, but the problem appears in LCL's TCalendar control.

TCalendar in Windows is a wrapper of native widget MonthCalendar ( In recent windows versions (since Win 7 or Win 8?) it has the look which you describe. With this new calendar, TCalendar makes a mistake, which I will try to describe now.

LCL's TCalendar has a method HitTest (, which (in mentioned TCalendar implementation found in recent Windows versions) incorrectly returns cpDate instead of cpTitleMonth.

And no, it doesn't work well with TCalendarDialog. The difference is that by design TCalendarDialog does not close the pop-up calendar on user's click, but only on double click, that is why you can click once on month and the pop-up Calendar does not close. But the code that TCalendarDialog uses to determine whether it should close is the same as in TDateTimePicker - it also checks TCalendar.HitTest. Try to double click on month and - it will close immediately.

To summarize, all I can do is to report this TCalendar's bug and see if it can bi fixed.

Bart Broersma

2016-02-13 15:38

developer   ~0089989

> Try to double click on month and - it will close immediately.
You are right.

Zoran Vučenović

2016-02-13 16:03

developer   ~0089990

I reported it - 29646.

Zoran Vučenović

2016-02-13 16:07

developer   ~0089991

I'm resolving it as fixed - no change required, as it is not DateTimePicker issue and now it is passed to new bug report 29646.

Issue History

Date Modified Username Field Change
2016-02-07 21:44 Peter Page New Issue
2016-02-07 21:44 Peter Page File Added:
2016-02-08 16:05 Bart Broersma Note Added: 0089854
2016-02-08 16:06 Bart Broersma LazTarget => -
2016-02-08 16:06 Bart Broersma Status new => confirmed
2016-02-08 16:08 Bart Broersma Assigned To => Zoran Vučenović
2016-02-08 16:08 Bart Broersma Status confirmed => assigned
2016-02-13 15:18 Zoran Vučenović Note Added: 0089988
2016-02-13 15:18 Zoran Vučenović Note Edited: 0089988 View Revisions
2016-02-13 15:38 Bart Broersma Note Added: 0089989
2016-02-13 16:02 Zoran Vučenović Relationship added related to 0029646
2016-02-13 16:03 Zoran Vučenović Note Added: 0089990
2016-02-13 16:07 Zoran Vučenović Widgetset => Win32/Win64
2016-02-13 16:07 Zoran Vučenović Note Added: 0089991
2016-02-13 16:07 Zoran Vučenović Status assigned => resolved
2016-02-13 16:07 Zoran Vučenović Resolution open => no change required
2016-02-22 00:54 Zoran Vučenović Relationship added related to 0029696
2016-02-22 00:56 Zoran Vučenović Relationship replaced has duplicate 0029696