1 (edited by tcoton 2023-05-25 16:18:07)

Topic: Bug in function "OpenCalendar" MVDB 6.5

I found a bug in the function OpenCalendar which opens a date picker way out of the place it should. In my case instead of opening right below the combobox date picker, it opens somewhere out of the project at top left. When you click on the cross to close the application window, it closes the date picker pop up and you must click once again to close the window!! If I use this function in a tab that calls a window which hides the main window within a project, it does the very same the first time I call it but if I close the called window and call it again, the date picker appears where it should.

script used : form1.datepicker.OpenCalendar;

I first thought it was something in my project, so I created a new one with just that and ... big bug!!

Post's attachments

Attachment icon autoopenpicker.zip 334.82 kb, 104 downloads since 2023-05-25 

Re: Bug in function "OpenCalendar" MVDB 6.5

I wouldn't call it a bug.


What is OnShow event in Delphi?
OnShow is called just before a form becomes visible.


At this point, the form's Position property has apparently not yet been set. poDefault fires.
The combo box in the upper left corner will also appear if you try to open it. Perhaps other components will also behave.


It may be recommended to open with a slight delay on the timer. Hurry up slowly.

Re: Bug in function "OpenCalendar" MVDB 6.5

Hi TCoton, Sparrow,
Perhaps as an option you could just place a monthcalendar object on the form (see attached);  it ends up doing the same thing.
Derek.

Post's attachments

Attachment icon autoopenpicker option.zip 335.08 kb, 115 downloads since 2023-05-25 

Re: Bug in function "OpenCalendar" MVDB 6.5

Hi Derek,


Fine. Also an option

Re: Bug in function "OpenCalendar" MVDB 6.5

sparrow wrote:

I wouldn't call it a bug.


What is OnShow event in Delphi?
OnShow is called just before a form becomes visible.


At this point, the form's Position property has apparently not yet been set. poDefault fires.
The combo box in the upper left corner will also appear if you try to open it. Perhaps other components will also behave.


It may be recommended to open with a slight delay on the timer. Hurry up slowly.

I also thought it might be a timer issue but it was working fine with Windows 7 but now with Windows 10 and 11, the date picker deploys outside the project windows even without a OnShow property set as in the zip file I sent. Is there a simple way to introduce a 0.5 or 1 second delay for just this?

Re: Bug in function "OpenCalendar" MVDB 6.5

Hi Derek,

thanks for the workaround, not very elegant (if you click on the deploying arrow while it displays the calendar, there is some "déjà vu" effect) but it does some magics.

7 (edited by sparrow 2023-05-25 21:28:48)

Re: Bug in function "OpenCalendar" MVDB 6.5

example

Post's attachments

Attachment icon autoopenpicker-fix.zip 333.26 kb, 127 downloads since 2023-05-25 

Re: Bug in function "OpenCalendar" MVDB 6.5

Thanks Sparrow, this is smooth!! Definitely a lot of code for just a delay but it works great smile