newTab not working

Hi all…

im trying to add a tab with the solution model but i cant make it work

i have a form with an empty tab panel and i want to put a form in a new tab there…

my code is the following

	var form = solutionModel.getForm('principal')
	var tab = form.getTabPanel('tab')
	
	var form2 = solutionModel.getForm('clientes')
	var t = tab.newTab('tab1', 'Nombre', form2)
	application.updateUI()

i tried it putting a form in the tab panel and doesnt work either… is this the proper use or am i forgetting something??

thank you in advanceed

Andres

You are mixing SolutionModel code with runTime code.

When you alter the solutiopnModel, the affected forms need to be removed from history first, before changes will be seen.

But in this case I thin you just need to look at the addTab function on the TabPanel element. You don’t need the solutionModel.

Paul

Hi Andres

I spent some time recently to

  • create a form with the solution model. It includes header, body and footer, tab panel on the footer with second form on it. Since there is no documentation available so far, all I can tell comes from my experience and answers I read an received in the forum
  • extend a form created with form designer with dynamic button bar.

I guess from your code, that you try to extend an existing form (‘principal’), created with the form designer, dynamically. By using the solution model you try to add a second form (‘clientes’) to a tab panel on the first form.

As far as I know, a form can either be created completely dynamically or extended dynamically as long as it is not used/accessed/created in Servoy (before first time onShow?). Even history.removeForm(formName) and solutionModel.removeForm(formName) do not help later. So I guess you have to find the right place in code to place your extension.

My code, to place a form on a tab panel, is the same as yours. The only difference I can see is, that I create both forms dynamically.

...
var tabPanelFooter = form.newTabPanel('tabFooter', startWidth, startHeight, width, height);
tabPanelFooter.anchors = SM_ANCHOR.EAST | SM_ANCHOR.NORTH | SM_ANCHOR.WEST | SM_ANCHOR.SOUTH;
var tab1 = tabPanelFooter.newTab('tab1', 'details', formFooter);	
application.showForm(newFormName);

Regards

thank you, guys, i just use the addTab from the element and did it, i thought i could mix solution modeling with forms already done…