Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Object References
Message
De
20/02/2001 19:37:40
Larry Rix
Larry Rix & Associates, Inc.
Westminster, Colorado, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Object References
Divers
Thread ID:
00477858
Message ID:
00477858
Vues:
71
Hi All,

I discovered today that object references on VFP Forms have a certain behaviour regarding object references to the form when the form is closed. In a nutshell:

A form object reference is held by Windows. The form object reference within VFP is somehow tied to the Windows reference and facilitates programming structures within VFP code. The actual reference generated and used by Windows is the real thing. Notwithstanding -- there is an issue that comes about when you close a form or when a user closes a form.

At close time, Windows destroys its reference to the open form. However, within the private memory arena of the form, VFPs form object reference lives on. Thus, within exiting events and methods (i.e., Destroy, Unload, Release, etc.), you may still reference the form via THISFORM and you may still store the object reference produced by THISFORM in a variable or property. Furthermore, you may even pass the reference to supplier or client classes outside the context of the form. However, this is where the catch begins.

All other VFP classes outside the form have thier references tied to the Windows reference. Thus, immediately upon Windows destroying the reference ALL other references within VFP become NULL. Only within the form itself will you find a still valid and operational reference THISFORM and data items derived from it.

Here then are some questions I have:

1. How many other VFP "objects" have dual references (e.g., Windows and VFP)? Only forms that I know of so far.

2. If I tie an object to an object property, does the object get destroyed if I set the property to NULL? This question arises because I have a situation where I have an arrayed list and one of the columns contains a reference to an object created with CREATEOBJECT. This array row is also tied to the form that I was speaking of above. Thus, when the form goes away and its reference becomes NULL, I do a "garbage collection" on the array looking for NULL form references. Consequently, the array row is deleted using ADEL. My only remaining question is whether the object created by CREATEOBJECT will be released when the array item containing its reference is set to NULL or False?

Larry Rix
Senior Programmer
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform