Multiple Form Hosting with page control

Hi i am trying to create an environment where i will host many forms in a pagecontrol.
It works fine until i ll try to host the same form in a different tab sheet.
At this point the form is been hosted well but i am loosing the buttons of the second form.
Also if i resize the window and change tab sheet the rendering is lost until resize the window.
I have created an example application i can send to you in order to see exactly what i am talking about.

Hi George,

We had that issue before. Basically, you can assign the each form's parent to its sheet in your create form's callback procedure, e.g. after AfterCreate. Hopefully this would solve the issue.


To address the rendering aspect, you can try something like this.

  setTimeout(() => { window.dispatchEvent(new Event('resize')); },0);  

Not sure if there is a better way or a TMS Web Core equivalent call or something more specific for your particular scenario.

Thank you both of you for the quick answers.
The solution from Peter works great for rendering issue.
Andrew i didn't try yours.
I still have the problem with the lost buttons.
I have uploaded the sample project to Github.

Also tried to create an extra button from code.
I have the same result. The second time i create the form in a different tab the run time buttons does show.

If you run the sample you will see a test button at the bottom of the page.
Each time you press it i create and show the same form in a new tab page.
From the second time i lose the buttons.
In the form there several other controls that seems to show normally.

Seems the problem is the speedbutton i use.
I replaced with simple buttons and works fine but i they don't have the glyph i need.

Can you elaborate a little bit on the glyph problem?

Below is the first time i create the form in a new tabsheet

And next is the second time i create the form in a second tabsheet

As you can see in the second tabsheet the button are lost (or non visible).

Now if i replace the speedbuttons and place simple buttons or images i have no problem no matter how many times i create the form in a new tabsheet

Don't assign the ElementID properties of those speed buttons than you will be fine. Because they try go into DOM with same element id. Or if you need to assign them in your code make them unique.

I investigated this and I do not understand why you use the speedbutton.ElementID? There is no HTML template associated with this form, so it doesn't make sense to set the ElementID.
Also, when you set this ElementID, when you create a second instance of the control referring to the same, existing ElementID, the control would be mapped on the already existing control, i.e. the one already on the first tab.
So, if you do not map the speedbutton on existing HTML in the form HTML template, do NOT use ElementID.

I see.
The plan was to use html in the near future. That's the reason i used elementid.
As i understand that's not possible.

Thank you all for your help.