I would assume that all these components would have unique Names? If so, why not create a global procedure that would delete/free components by Name. Inside this procedure would dynamically cycle through all the components/controls using the Controls property (remember to do this recursively so that you can get down into the deepest level of parentship) and delete the appropriate one. You could also use the Tag instead of the Name of course.
 
An alternative would be to have a global TList where you "register" all the dynamic components created. You can then use this TList instead of the Form to traverse the list of dynamically created components (it may be a bit easier than the recursive approach mentioned above).
 
It all depends on what criteria is used (and how the selection is made) on what components you want to delete....
 
Hope this helps
Xander
----- Original Message -----
Sent: Friday, December 10, 1999 11:38 AM
Subject: [DUG]: Multiple Dynamic Components

Hi all.
 
I am just tweaking an app. I have been working on for a while now, and I want to have the ability to have multiple components created dynamicaly...ok, that bits fine, BUT if I want to FREE one of them (say dynamic component #5) I cant, as its not a global control, i.e. its created inside a procedure., and there is no ref. to it outside the procedure  its been created in.
The simple answer is ofcourse, jst declear it so that it is visible to the whole app. BUT the problem here is, I am not sure how many I will need, or rather how many the USER will want to have, could be none, could be 10 or even 20...who knows.
 
How then, do I get around this ?  any ideas/suggestons ?
 
thanks,
 
Jeremy Coulter (manager)
Visual Software Solutions

110 Harewood Road
Christchurch
ph +64 3 3521595
fx +64 3 3521596
cell +21 2533214
http://www.vss.co.nz
 

Reply via email to