Suicide ContainerControl

Hi,
I want to create a dynamic filter like Numbers have
The filter element removable with trash button, I marked with the red arrow.

I follow the example project DownloadContainer. It has a “Clean Up” button.
The question is: how can I remove a ContainerControl pressing of own trash button?
Really must set up a timer for cleaning up the array and adjust the remain container’s top property for clear away the gap?

Think you can just place

self.close

into the trash button “Action” Event Handler.

Than you should add some handler into the window that intercepts the close of the container control and resizes the remains to fit the available space.

And how can catch that close event in its parent (or TrueWindow).
Perhaps throw an exeption upwards?

[quote=226790:@Zsolt Szokolai]And how can catch that close event in its parent (or TrueWindow).
Perhaps throw an exeption upwards?[/quote]

Maybe call a method in TrueParent from the ContainerControl close event and pass the name of the container. Not the containerControl itself, that reference could prevent it from closing.

In the Close event call a method in the parent to do the necessary work and then call Super.Close().

I found a solution in TabbedWebBrowser example. In method AddNewTab:

browser.ParentBrowserWindow = Self

Then I can call any method of containing window including cleanup.

Thank you all for your help.

more simply:

Window1(TrueWindow).Cleanup

I was so unlearned I did not know the TypeCasting.