Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finally !! How to safely release objects in a Control Array
Message
De
11/12/1996 16:25:16
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Titre:
Finally !! How to safely release objects in a Control Array
Divers
Thread ID:
00014854
Message ID:
00014854
Vues:
95
I discover how to deal with control arrays, and get rid of them in a safe way:

If you create an array property in your form, i.e.
THISFORM.aObjs[1]

and then redimension the array for adding objects with AddObject(), i.e.

DIMENSION THISFORM.aObjs[3]
THISFORM.AddObject("THISFORM.aObjs[1]","CommandButton")
THISFORM.AddObject("THISFORM.aObjs[2]","CommandButton")
THISFORM.AddObject("THISFORM.aObjs[3]","CommandButton")

The code for releasing those objects, acording to MS, is doing a redimension to the array. But you can't set the array to 0 objects !!. And, with the command DIMENSION THIS.aObjs[1], you are just releasing 2 objects. If you store a .NULL. in the element 1, you are NOT releasing the object 1.

And sometimes, when you try to release the form, it won't close.

To avoid this, ALWAYS add the objects beginning at the element 2. Then, to release the objects, just redimension the array back to 1 element.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform