Do not updates date in TDateTimePicker in second and next call of ShowModal
Original Reporter info from Mantis: Petrovitch
-
Reporter name: Andrey Petrovitch
Original Reporter info from Mantis: Petrovitch
- Reporter name: Andrey Petrovitch
Description:
I found an very painful bug with TDateTimePicker on modal form.
After first call of ShowModal any attempts to change the value of Date or DateTime
of TDateTimePicker not lead to visible results. TDateTimePicker stay to display
the original value which was setted before first call of ShowModal.
We made an investigation and found some interesting changes in the ShowModal source.
---
customforms.inc in Lazarus 1.6.2 distributive line 2880:
if PopupMode = pmNone then
begin
RecreateWnd(Self);
HandleNeeded;
end;
---
customforms.inc in Lazarus 1.6.4 distributive line 2883:
if (PopupMode = pmNone) and HandleAllocated then
RecreateWnd(Self); // need to refresh handle for pmNone because ParentWindow changes if (fsModal in FFormState) - see GetRealPopupParent
line 2953:
if ((PopupMode = pmNone) and HandleAllocated) and not (csDestroying in ComponentState) then
RecreateWnd(Self); // need to refresh handle for pmNone because ParentWindow changes if (fsModal in FFormState) - see GetRealPopupParent
---
What we see? No handle recreated after first call of ShowModal!!
Next, let we see at TDateTimePicker source.
Procedure UpdateDate line 2661
if HandleAllocated then begin
FCorrectedDTP := dtpAMPM;
FUserChangedText := False;
..................
No handle - no update. It is correct?
Steps to reproduce:
See applied example
Mantis conversion info:
- Mantis ID: 31571
- OS: Windows
- OS Build: 7
- Build: 54278
- Version: 1.6.4
- Fixed in revision: 54495 (#bf733a19)
- Monitored by: » Petrovitch (Andrey Petrovitch)