View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0038108||Lazarus||IDE||public||2020-11-21 03:57||2020-11-23 03:01|
|Reporter||Jorge||Assigned To||Zoran Vučenović|
|Platform||Linux Mint||OS||Linux Mint|
|Summary||0038108: Bug in DateTimePicker|
|Description||When 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.|
|Tags||No tags attached.|
|Fixed in Revision|
I also see that. Choosing date generates onActivate event for TForm.
My system is Win10, Lazarus 2.0.11, fix patch build.
||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!|
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.
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 .
|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|