get the parent form

Hi there,

I need some code where I can detect on which form, my form is placed (in a tabpanel)

for example:

I have form B, which is placed in a tabpanel on form A.
I want to detect on form B that I’m placed on form A (kind of getParentForm ;-) )

I can’t use currentcontroller, because in my case, form A ‘can’ be placed in a tabpanel on form C.

Anyone??

I don’t think there’s a straight forward way to do this. Looping recursively through all the tabs from the currencontroller form doesn’t work if your form can be on multiple tabs, as you said.

So I think the only option is to “keep track” yourself while your user is navigating through your application. For example: Have a global onShow-method add the formname to a global array for all (levels of) forms.

As a form can only be visible once, you could loop through the entire tree of visible forms.

For now that is the only option.

In the next major version of Servoy, we’ll introduce a function on the form object to get it’s parent. This will off course only work for visible forms.

Paul

pbakker:
As a form can only be visible once, you could loop through the entire tree of visible forms.

For now that is the only option.
Paul

Do you have some sample-code how to loop through a tree, of visible forms??

1- Start at the currentcontroller
2- Loop through the elements on the form to find all tabpanels, or use the solutionModel (>=4.1) to get all the tabpanels
3- for each tabpanel:
4- get the form in the active tab and do step 2 again

Paul

ah thanks,

will try that