Refreshing forms in tabPanels that are in TabPanels

I have the following structure:

MainForm
…|____tabs_Controller
…|____tabs_70
…|__frmActivity
…|__frmProject
…|__frmEntity
…|____tabs_70
…|____tmLstEntity (a list of entities)
…|____EntityForm (an entity file)

The entity file view (with root frmEntity__) elements.tabs_70.EntityForm is not editable. This is because the interface allows for a very speedy navigation between Activities, Projects and Entities.

When the user clicks on a button (btnLock) to edit the an Entity, the method btnLock shows the same EntityForm (with same changes - hide some of it’s own tabPanels,resize,…) with application.ShowFormInDialog().

My problem is that when I close the dialog the EntityForm is not properly redrawn! I found a work around but it makes the form look like fireworks (lot’s of flickering).

Is there a better solution?
Also I’m interested in knowing if this approach makes sense in Servoy?

Here’s the code for the btnLock method:

var startWidth = forms.EntidadeFicha.width;
var startHeigth = forms.EntidadeFicha.heigth;

// prepare form to display in dialog
forms.EntidadeFicha.elements.tabs_70.visible = false;
forms.EntidadeFicha.width = 900;
forms.EntidadeFicha.heigth = 400;

application.showFormInDialog( forms[elements.tabs_70.getSelectedTabFormName()],
                              -1, -1, 900, 400,
                              'Edita Ficha de Entidade', false, false, false);

// reset form to display properly
forms.EntidadeFicha.elements.tabs_70.visible = true;
forms.EntidadeFicha.width = startWidth;
forms.EntidadeFicha.heigth = startHeigth;

// This must be done in order to refresh EntidadeFicha.elements.tabs_70
elements.tabs_70.tabIndex = 1;
elements.tabs_70.tabIndex = 2; // the original is this one

thanks for all the help.
Best,
mjekl

Well the problem is you cannot have a form visible on 2 places at the same time.

Suggestion to use:

...
var selectedForm = forms[elements.tabs_70.getSelectedTabFormName()]
var oldTabIndex = elements.tabs_70.tabIndex
elements.tabs_70.tabIndex = (oldTabIndex - 1) //show another one, TODO make safer incase first form is selected
application.showFormInDialog(selectedForm ,...)
elements.tabs_70.tabIndex = oldTabIndex
...

Yes. I see now I’m using the same instance in two places simultaneously (and not two different instances of the same object).

Thanks for the explanation and tip.
mjekl