Quickly clear ALL embedded containers

Hi all - So I can close each embedded container by creating a loop and closing each one at a time (as outlined perfectly in other posts). But with over 100+ embedded containers in my solution, this can take some time. It’s much faster to close the window, then reopen it, and like magic all embedded containers are gone. But this is rather clunky if I just want to wipe the slate clean and NOT close. Any thoughts or things to try?

my first thought was to rethink your GUI design

Wish I could but not possible (at the moment at least)

guess it really depends on how you are closing them
when you embedded them did you keep a reference to them ?

[quote=450661:@Norman Palardy]guess it really depends on how you are closing them
when you embedded them did you keep a reference to them ?[/quote]

Yes, array property. That’s what I am currently looping through.

I should add that Redim does not actually do anything to the embedded containers, just breaks all references to them.

Container controls / embedded windows are a bit … well … screwy
In a lot of ways they are like windows so whether you keep a reference or not they dont just go away if you nil them
You have to call close on each then set the reference to nil
But, that said, the IDE uses lots of containers embedded in it and there’s no huge speed issue I’ve seen because of that
There are other speeds issues for other reasons but not just embedding and closing container controls

[quote=450669:@Norman Palardy]Container controls / embedded windows are a bit … well … screwy
In a lot of ways they are like windows so whether you keep a reference or not they dont just go away if you nil them
You have to call close on each then set the reference to nil
But, that said, the IDE uses lots of containers embedded in it and there’s no huge speed issue I’ve seen because of that
There are other speeds issues for other reasons but not just embedding and closing container controls[/quote]

That’s what I thought Norman, thank you. The speed isn’t more than a couple seconds, just seems like it should be almost instantaneous to do a ‘close all’ (which Xojo has on other controls like listbox). My solution is emulating a legacy FileMaker project and embedded containers seemed the best way to emulate FileMaker’s ‘List View’. ideally I’d use a listbox but there were some custom things I needed to accomplish that are just not possible in a listbox. I love the flexibility of containers and embedding them, once you get the hang of it, is a nice way to go. Anyway, my comment is way ‘out of scope’ for this topic so…

If anyone else has any thoughts, please chime in. :slight_smile:

I wonder if you could embed all those child containers in a parent container then dispose of just the parent and see if there’s a difference? I wouldn’t think so, but you really never know.

No, that appears to actually be significantly slower.

What about either looping through and setting coords to offscreen or visible property to false then setting a background thread to loop through and actually close them ?

I tried setting visibility and using LockWindowUpdate on Windows. No reduction.

Or as you move them and make them invisible, start a timer inside each of them that will close themselves after five seconds — enough for you to repopulate the screen with 100+ new containers.