View Issue Details

IDProjectCategoryView StatusLast Update
0038108LazarusIDEpublic2020-11-23 03:01
ReporterJorge Assigned ToZoran Vučenović  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
PlatformLinux MintOSLinux Mint  
Product Version2.0.10 
Summary0038108: Bug in DateTimePicker
DescriptionWhen I select a date, the Form's onActivate event is activated. Example. I have an Edit and a DateTimePicker, in event Form's onActivate I have write Edit1.clear then when I select a date, delete what is written in the edit.
TagsNo tags attached.
Fixed in Revision
LazTarget
Widgetset
Attached Files

Activities

Andrey Sobol

2020-11-21 07:54

reporter   ~0127078

I also see that. Choosing date generates onActivate event for TForm.
My system is Win10, Lazarus 2.0.11, fix patch build.

wp

2020-11-21 11:32

developer   ~0127080

I think it is bad design when you put initialization code into the OnActivate handler. Suppose your project contains another non-modal form. Then the user can toggle between the main and the second form at any time. Each time when the form with your Edit1 regains focus OnActivate will fire, and the Edit1 will be erased!

Zoran Vučenović

2020-11-21 14:26

developer   ~0127082

The only solution that I consider clean would be that drop-down form does not still focus from DateTimePicker's parent form in the first place.
But I doubt it is possible. I'll try to see if some workaround can be found...

And, just to say, I agree with WP, but... even if it is bad design, it is still not an excuse for DateTimePicker calling it whenever drop-down calendar closes.

jamie philbrook

2020-11-23 03:01

reporter   ~0127128

if you ask me I think it's working exactly as it should be ?

The form that is created is a different window, its not a child window of your form so this behaves like it should in that respect.

I think any hacking to change this behavior should be avoided.

The control has a OnCloseUp event that can be used to set a flag to be examined in the OnActivate event of the form.

For example, I just placed the variable Flag:Boolean in the form and during the Activate I read this and during the CloseUp in for the picker I set it,.
it works out fine this way.
  But this should be in user code .

Issue History

Date Modified Username Field Change
2020-11-21 03:57 Jorge New Issue
2020-11-21 07:54 Andrey Sobol Note Added: 0127078
2020-11-21 11:32 wp Note Added: 0127080
2020-11-21 14:09 Zoran Vučenović Assigned To => Zoran Vučenović
2020-11-21 14:09 Zoran Vučenović Status new => assigned
2020-11-21 14:26 Zoran Vučenović Note Added: 0127082
2020-11-23 03:01 jamie philbrook Note Added: 0127128