Issue:
An application crash occurs when a Close or CloseWithReturn of the parent window is invoked either directly or indirectly from the DoubleClicked or Clicked event of the MonthCalendar control.
Background:
We currently use a really old ActiveX Calendar control which I want to replace with the standard PB MonthCalendar control that is almost identical.
The Calendar control sits in a popup window and on the DoubleClicked event of the control a CloseWithReturn of the parent window is executed which closes the window and returns the selected date.
I am trying to recreate this using the PB MonthCalendar, however, it causes an app crash both when running from the IDE or compiled.
I have also tried coding the CloseWithReturn in a button and on the Key event of the window and then calling these events from the DoubleClicked event of the CalendarMonth, but this still causes a crash.
When debugging I can see that all of the code in the Key event or button clicked events is executed (plus any code that I put in the Close event of the windows), PB then returns to the DoubleClicked event and crashes.
Does anyone have any ideas to get this to work, am I missing something obvious?
FYI - I am using PB 2017 but have also tried this in the 2019 Beta and get the same issue.
I wasn't aware of this technique, I have always used dot notation or TriggerEvent.
You have to remember that in controls like this (or especially DW Controls) there are often other events (MS-Windows message queue entries) that are still waiting to fire to complete the processing of what is happening to that control. Closing the Window where these controls live and interrupting the message queue processing for these controls in an major event like a Double-Click is certainly a "death" wish. So always "POST" a user event from the regular PowerScript event to allow remaining events to fire and complete before a Close or Destroy command (ie : DataStore) is used.
This has been a PB App "Public Health Awareness" message! ;-)