Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code in Destroy event not working
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00834381
Message ID:
00834748
Views:
30
Yes, object may remain in memory but as null. Here is how you can check it.

Create a form with only one button having code:

WAIT WINDOW time 0.5 "Button "+TYPE("FORM1")+TRANSFORM(ISNULL(form1))
thisform.release

And in the form.release, form.destroy, and form.unload put the similar messages:

WAIT WINDOW time 0.5 "Destroying... "+TYPE("FORM1")+TRANSFORM(ISNULL(form1))

Now call the form like:

do form yourform name FORM1

Then you see how it behaves and in what order events are fired.
Additionally you may see the differences if you close the form via closebutton on the form window titlebar.

>Hi Yuri. Thanks for your reply.
>
>So it IS possible for the Form to be destoyed before code has finished executing, even though that code is called frommthe Destoy event ??
>
>Regards,
>
>Gerard
>
>
>
>>Possibly it happens because form is destroyed before MyPrg is completed. Try to add some code to suspend form destroy execution until MyPrg is completed.
>>
>>>I have the following code in Destroy event of a form:
>>>Do MyPrg with thisform
>>>
>>>In MyPrg:
>>>Parameters oForm
>>>wait window oForm.caption .......
>>>
>>>Most of the time this works but the ODD occasion, an error comes up saying oForm is not an object. I cannot repilcate this myself on testing but it has happened a few times out on site !!!!
>>>
>>>Is it possible for the Screen to be destroyed by the time the code is run ? or is there any other reason this would not work ?
>>>
>>>Regards,
>>>
>>>Gerard
Previous
Reply
Map
View

Click here to load this message in the networking platform