I extend a form programmatically in the solution model but it is not showing as expected.
Scenario:
oneForm is based on one table, anotherForm is based on another table.
In anotherForm’s onShow event the table of oneForm is changed to be the same as anotherForm’s.
Then anotherForm’s ‘extendsForm’ property is changed to ‘oneForm’.
anotherForm is shown but it does not show any elements are on oneForm.
(debugging shows that anotherForm extends oneForm)
maria:
In anotherForm’s onShow event the table of oneForm is changed to be the same as anotherForm’s.
Then anotherForm’s ‘extendsForm’ property is changed to ‘oneForm’.
You can’t alter a form with the solution model once this form is already ‘touched/loaded’.
As the ‘onShow’ event will only be triggered when a form is already ‘touched/loaded’, this will never work…
I think you should do the job in the calling method (global?)
Actualy it will in servoy Tano because you will have the new function forms.formname.controller.recreateUI()
Thanks Sanneke, good to know that.
How about a situation where one form extends the other at design time.
At runtime I add an element and resize another element on the parent form and then try to show the extended (child) form but the new element is not showing on it.
Is it the same problem of recreating the UI?
when do you change the parent?
also in the onshow of the child?
Then you have that same problem, the child is already there and in the UI child and parent are 1 thing so changes to 1 of them when the child is already visible will not result in any change in the ui
in Tano you can call that recreateUI() method for this yes.
jcompagner:
when do you change the parent?
also in the onshow of the child?
Then you have that same problem, the child is already there and in the UI child and parent are 1 thing so changes to 1 of them when the child is already visible will not result in any change in the ui
in Tano you can call that recreateUI() method for this yes.
Johan, it’s not in the onShow of the child but yes, the child is visible. I thought the changes would be applied because I use history.removeForm() and then show it again.
Looks like I’m stuck. Would you be able to suggest any other way of doing what I’m doing?
I’m working with the search screen where the user is able to add search criteria when they wish.
There is a form to display a few fields for search criteria, such as ‘search by smth’, ‘search type’ and the search string.
This little form is reusable throughout all other modules and is not displayed on any form directly. Each module has a form that extends this one.
The search screen is also reusable, so each module has a search screen which is child of this common parent.
When the user wants to add search criteria I create an instance of the existing module-specific child, then create a tabPanel on the parent search screen and put the new instance on it. That’s where problems begin: if I show the parent form the new instance is there but another tab is not there because it’s only on the child search screen; if I show the child search screen it does not have the new instance.
Is there any other way to implement this? I tried to manipulate solutionModel and create new forms in it as opposed to instances. It worked when I did not have extended forms at design time (when each module had its own independent search screen that did not extend any other form).
First you understand if you change the parent you change that for ALL forms that extend that one and that are created after that?
yes history.remove() is the way to go, but that will return a boolean value if it could be removed
and if the form is still visible then it cant be done.
You have to show first another form and then remove it then alter that form (or its parent if the parent isnt used anywhere else!)