>>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 #831, 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.
Sergey,
Do you think creating an array of objects as described in my FAQ #8110 (and in the sample posted above, by Len Speed) would result in a memory leak - meaning, the objects aren't released correctly, when the form is released? How can I test for memory leaks?
TIA, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)