How to show a created form again?

Dear Bruno, thank you for your response!
The FormHosting demo works because it USES close. But the point of my issue is that I do NOT want to use Close, so to not lose the form content.

If I remove the Close from the demo, the demo fails. In the first example attached I reduced the demo to the absolute necessary. The 2 subforms are only created once when they are used the first time. When then toggling between the 2 subforms I set the currently visible form to visible:=false and the other form that I wan to show to visible:=true. And exactly this does not work!
My demo does extensive logging into the console. Please have a look.
Here is what happens:

  • Click button 1 --> Subform1 will be created -> Subform1 shows OK
  • Click button 2 --> Subform1 will be set invisible and Subform2 created. --> Subform1 disappears but Subform2 does NOT show
  • Click button 1 --> Subform2 will be set invisible and Subform1 set visible --> Very strange: Subform2 shows up, while 1 was expected
  • Any further clicking on any button does not change anything to this state. Subform2 stays visible.

Formhosting toggling visible.zip (55.8 KB)

Then, based on the idea that almost anything is async, I thought that setting visible:=false maybe needs some time in order to change the DOM and therefore a delay between hiding and showing may fix the problem. But it doesn't. Result is the same. And yes, the delay is made async as well using a timer.

Formhosting Async Show.zip (56.1 KB)

Many thanks for having a look into this! I think it is a crucial issue.

Kind regards, Walter