application.createNewFormInstance() behavior..

To make sure that developers understand this method:

It creates only a copy (another instance) of the form that you give it so that you can show that 2 times on a form.
BUT if that form also does contain again other forms then those forms are not created copies of… So when you also show those forms on other places you will see gray area’s on those places if you displayed them twice.

So if you have FormA that has FormB in a tab and you show that in the main window (or another window) and you create an new instance of FormA call it FormAA and you show that in a new window. Then FormB will disappear in the main window.

To fix this you also have to make a new instanceof FormB (call it FormBB) and add that to the tabpanel of FormAA … (and remove there FormB)

We hope to completely fix this in the next version of servoy. But then the programming model will change a bit.
Then tabpanel forms should always be access through the tabpanel of the main form elements.tab.x.elements not through forms.x.elements…

We hope to completely fix this in the next version of servoy. But then the programming model will change a bit.
Then tabpanel forms should always be access through the tabpanel of the main form elements.tab.x.elements not through forms.x.elements…

Hmm, not sure that I would like that.
If I understand correct, that would basically mean that I would have to create a second form (not an alias) when I want to show the ‘same’ outside the panel.
If so I don’t think that is a real solution, for me anyway…

Formname = ‘myForm’
Instancename = ‘myInstance’

var _form = application.getMethodTriggerFormName();

  1. forms[_form].elements.startdate1.enabled = false
  2. elements.startdate1.enabled = false

Normally _form should have the value ‘myInstance’ when this coding is executed in my instanced form.

In that case situation 1 works correct. It will be equal to
forms[‘myInstance’].elements.startdate1.enabled = false

But how about the second case. There is no forms prefix.
Should case 2 work on myForm or myInstance?

It now seems to work on myForm, but is that correct?

It now seems to work on myForm, but is that correct?

I’m not sure I understand your question but I guess the answer is yes (see the docs)…

I don’t think that is logic. If I have an instanced form, it should work on my instance and not on the orginal form

As I said I don’t really understand your question.
Imho you never call an element that way outside the form that it is on so it works on any form that it is on :?