The Delphi Bug List

Entry No.
671
VCL - Win32 - ComCtrls - TDateTimePicker
If you enable checkboxes (by setting ShowCheckbox := True), and then try to change the date value either by the up/down keyboard arrow keys, or using up/down buttons (if DateMode = dmUpDown), the date will be changed one step but focus will then be transferred to the checkbox.
1.02 2.01 3.0 3.01 3.02 4.0 4.01 4.02 4.03 5.0 5.01 6.0 6.01 6.02 Kylix 1.0
N/AN/AUnknownUnknownExistsExistsExistsExistsExistsExistsExistsExistsUnknownUnknownN/A
Description
Reported by Björn Lindell; checked by Jordan Russell
If you enable checkboxes (by setting ShowCheckbox := True), and then try to change the date value either by the up/down keyboard arrow keys, or using up/down buttons (if DateMode = dmUpDown), the date will be changed one step but focus will then be transferred to the checkbox. After that if you press up/down (either through keys or button), the date will not change. You need to click in the datetimepicker-control again to give it focus again, but then you still can only change one step before losing focus again.

I compared this with the behaviour in the Find Message function in Outlook Express 5.x (which exposes checkboxes for date ranges), there is no problem there.

The offending code seems to be in "comctrls.pas" in

procedure TDateTimePicker.CNNotify(var Message: TWMNotify);
probably something of the code under the case-clause DTN_DATETIMECHANGE:
Solution / workaround
I managed to create a workaround by making a subclass and reimplementing a stripped down version of CNNotify (basically copying the code and removing stuff), but since it uses a lot of private variables, I mainly had to remove code, so I am not sure what possible side effects this may have. The best course would be to modify the ComCtrls.pas code itself, but since I don't want to use a recompiled version of this unit (since I fear that the precompiled version may not be in synch) I have not tried this.
User-contributed comments
M. Biedermann
30 Jul 2002  01:33 PM GMT
Bug still exists in Delphi 6.02

Furthermore, with ShowCheckbox = False, the control will no longer get a visible focus when you once used the DropDown Calendar (even if you ESC out of it).
It seems the now invisible Checkbox gets the focus. You can bring it back to the date area by using CursorLeft/Cursor Right.
Latest update of this entry: 2001-06-18

Post a comment on this bug


Index page
Delphi Bug List home page
The Delphi Bug Lists are presently maintained by Jordan Russell, who has taken over this task from Reinier Sterkenburg since August 2000.
All feedback is appreciated. See also the feedback section of the Delphi Bug List home page.