Clearing a Webcontainer

I have a simple web app that needs to display different pages based on a selection from a listbox. So I have defined two WebContainers one called Collector and One called Accelerator. Each have some buttons and labels nothing complex and all for display. When the user selects Collector the screen shows the Collector Container. When the user selects the Accelerator the Accelerator Container is displayed on top of the Collector Container instead of clearing it.

How do I clear it? I have been able to add a button in each container with a pressed event and the code “self.close”. This has the right effect but the user has to click it before switching screens. How can I get this to run when the user selects the alternate WebContainer. Below is the code that selects the containers when clicked from a listbox.

Var Conr1 As  New Collector
Var Conr2 As  New Accelerator

Var Generic1 As New Generic

Generic1.LockLeft = True
Generic1.LockTop = True
Generic1.Width = 1191
Generic1.Height = 606 = 20
Generic1.EmbedWithin(Self, 405, 20, Generic1.Width, Generic1.Height)

if data = "Collector" then 
  Conr1.LockLeft = True
  Conr1.LockTop = True
  Conr1.EmbedWithin(Generic1, 405, 20, Conr1.Width, Conr1.Height)
end if

if data = "Accelerator" then 
  Conr2.LockLeft = True
  Conr2.LockTop = True
  Conr2.EmbedWithin(Generic1, 405, 20, Conr2.Width, Conr2.Height)
end if

Put the containers in a Page panel with two pages and clear the hiding page contents when they switch. No need to close the containers.

1 Like

Why is it the easy ones are so hard to solve??? Thank you problem solved!

1 Like

Sometimes you can’t see the Tree because you’re stuck in the middle of a Forest. That’s why this forum is invaluable. Someone is always outside your Forest and can see the Tree from a different perspective.


So very true have been there many times. Thank you again.