Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get rid of a container in a container?
Message
From
16/01/1999 17:04:51
 
 
To
16/01/1999 14:33:10
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00176899
Message ID:
00176917
Views:
34
>I have a rather weird form - it has a container, which has another container as a member. The inner container has an array property, which gets populated with a series of containers. These innermost containers are instantiated from a class, and they contain actual controls. So far everything works fine.
>
>A moment comes to repopulate the inner container with a new set of innermost containers. I've tried many things, including
>
>- setting the array property to null, like this: cntOut.cntMid.rows=.null.
>- setting them to .null. individually
>- releasing each one of them: Release cntOut.cntMid.rows[i]
>- removeobject: cntOut.CntMid.RemoveObject("cntOut.cntMid.rows[i]")
>
>In the last case, the .RemoveObject seems to work, but in the debugger I still see all of the inner containers, and when I repopulate the .rows[] array, I see new objects added. The old ones are covered by the new ones (I do it programmatically, because the populating routine fills the middle container top down), but the old ones still receive focus.
>
>I think there are no dangling references in the innermost containers; all the references are from the form downwards (outer container is a member of the form, inner container is a member of the outer, innermost containers are AddObject()ed to the inner one, controls are members of the innermost containers). It's just that the innermost containers won't go away.
>
>Anyone with something better than rat poison? Should I just try to reuse them (they're all of the same class)?

Hi Dragan,
I have a similar form, which dynamically adds/removes containers, each of which contains a variable number of objects, each of which are containers.
I have a form based array and use AddObject/RemoveObject by scanning through the array elements. eg.
	FOR m.ii = 1 TO ALEN(.a_acddisp, 1)
		* remove the display container objects
		.RemoveObject("dispBox" + .a_acddisp[m.ii,1])
	ENDFOR
Each of these 'display boxes' can contain a variable number of display objects.
Funny, but removing the dispBox object seems to remove every thing under it automatically without any further code. Seems to work just fine. (60 users on line all day every day) Sorry I can't check the debugger since this program only works 'live' connected to a PABX phone system which I don't have here :-)

You could run the thing 1000's of times and see if you're really losing memory, or if it's just a debugger glitch?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform