1. Yiannis Papadomichelakis
  2. PowerBuilder
  3. Friday, 24 May 2024 12:14 PM UTC

Does it make sense the window close event to be fired BEFORE the window deactivate event?

I am facing a situation where I have null object references in the deactivate event, because the objects are destroyed.

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 24 May 2024 12:39 PM UTC
  2. PowerBuilder
  3. # 1

Hi Yiannis;

  FWIW: I've learned over a few decades with many versions of PB & Windows O/S that you can never trust objects to be around in memory. I've found that various events can fire differently & change sequences as well.

   To be safe, I always wrap my code in an IsValid() method to ensure I can still operate on an object.  HTH 

Regards ... Chris 

Comment
  1. Yiannis Papadomichelakis
  2. Friday, 24 May 2024 12:51 PM UTC
Sure, i tried that! No luck!

The closing window has objects that contain arrays of other objects and the problem I am facing is related to the array.

All window objects are valid, except these inside the array.

The array's size is greater than 0 but all it's elements are destroyed!

So, practicaly I have to use IsValid() in everything????
  1. Helpful
  1. Andreas Mykonios
  2. Friday, 24 May 2024 13:29 PM UTC
Don't know if moving that code to closequery can be an option in your case. Closequery is always executed before both close and deactivate...

Andreas.
  1. Helpful 1
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.