Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AddObject/RemoveObject
Message
De
22/03/2002 09:52:50
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00635975
Message ID:
00636016
Vues:
21
>>I posted this first as a reply to Hilmar, as the original thread was marked as answered, I'm reposting as a new problem - apologies to those who've already read it.
>>
>>Following Hilmar's advice & FAQ #8110, I'm adding obects to an array on a form. This is all working as per the FAQ. Now, I'm trying to add further functionality & have found the following problem. If I add an object with a specific name & then remove it then the object disappears from the screen & the Destroy method is called :
>>
>>
>>thisform.addobject( "NewObj1", "MyObject" )
>>thisform.removeobject( "NewObj1" )
>>
>>
>>If I use the technique described in the faq, thus :
>>
>>
>>thisform.addobject( "thisform.alabels(3)", "MyObject" )
>>thisform.removeobject( "thisform.alabels(3)" )
>>
>>
>>then the object does not disappear from the screen & the Destroy method is not called. thisform.alabels(3) is set to .F.
>>
>>I'm guessing the object is not correctly destroyed, giving the possibility of a 'memory leak'. Does anyone know how I should correctly remove the objects added into the array.
>
>All objects created this way have the same name as an array 'alabels'. The RemoveObject method requeres the name of control as a patrameter and "thisform.alabels(3)" isn't the name of control. Issuing thisform.removeobject( "alabels") multiple times will remove the objects one by one.

It seems to be a problem with the addobject method allowing an "illegal" object name ie alabels(3), converting it to something acceptable & then not raising an error when further objects are added. So there's multiple objects with the same name & no error generated.

After all these years of working with VfP, I should have known that there was not going to be an easy solution.
Len Speed
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform