1. Gordon Leishman
  2. PowerBuilder
  3. Tuesday, 14 May 2019 06:48 AM UTC

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.

Accepted Answer
René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 14 May 2019 07:00 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi Gordon,

you should create a bug ticket for this issue.

Have you tried to Post the call of Close or CloseWithReturn?

Comment
  1. Gordon Leishman
  2. Tuesday, 14 May 2019 07:25 AM UTC
Thanks Rene, you're a legend, using Post worked!!

I wasn't aware of this technique, I have always used dot notation or TriggerEvent.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 14 May 2019 15:33 PM UTC
Yes, its not a PB bug ...

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! ;-)
  1. Helpful
  1. Gordon Leishman
  2. Wednesday, 15 May 2019 00:26 AM UTC
Thanks Chris, I feel more healthy already :)
  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.