Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AddObject/RemoveObject
Message
De
25/03/2002 09:34:29
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00635975
Message ID:
00636790
Vues:
18
>>Hilmar's method of using AddObject DOES work correctly, without need to clean up yourself. VfP unfortunately modifies the names of the objects it adds to the form, so the RemoveObject does not find them again - but they are still in the Controls array & are correctly cleaned up on releasing the form.
>
>Len,
>
>I still would not recommend using the array stuff. For one reason it doesn;t provide any benefit, the form has a controls collection so the array doesn't add anything.

I agree with you & have moved away from using the array, my original question was how to avoid having to generate unique names for the objects & the array method seemed to provide that. I've found an acceptable (for my app) way of generating the unique names.

>The main reason I wouldn't recommend it is that AddObject wants the object name as the first argument and using teh "thisform.array(x)" causes there to be multiple controls all with the same name. Try the code below and you can see what I mean.

Your response seemed to imply that a manual cleanup was required - I was just pointing out that it's not necessary. It seems that a bug within VfP that it accepts the array format name & correctly assigns to the array, but "secretly" modifies the name used by the object - rather than Hilmar breeaking OOP principles it is VfP.
Len Speed
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform