Hi
Curious to know, if it is possible to use Solution Model, with Servoy mobile to generate the UI ?
Thanks
Hi
Curious to know, if it is possible to use Solution Model, with Servoy mobile to generate the UI ?
Thanks
yes it is.
Can you please add some sample code to add a button to an existing form, using Solution Model ?
Writing some thing like this don’t work.
var frm = solutionModel.getForm(controller.getName());
if (frm) {
frm.newButton('New Button',12,245,20,20, null);
// controller.recreateUI();
}
And again there is no controller.recreateUI() method. So how to handle the stall form exception ?
Please create a feature request for recreateUI in mobile client.
Currently you can alter an existing form, but only when it’s now being shown:
history.removeForm('companies');
var f = solutionModel.getForm('companies');
var met = f.getMethod('myMethod');
met.code = "function myMethod() { /* do something */ }";
f.newButton("added with SM",0,5000,0,0,met);
forms.companies.showMyself(); // that does a controller.show()
Currently with the latest Servoy version (Version: 7.2.0 rc - build 2012), the solution model stuffs working correctly.
Now, do we really need a recreateUI method, when there is no stall form exception thrown?
pradiptab:
Currently with the latest Servoy version (Version: 7.2.0 rc - build 2012), the solution model stuffs working correctly.
- Even if the form is not displayed, I can change the form using SM.
- If the form is displayed and I am changing the form using SM, still it don’t trigger any stall form found exception. But strangely, it redirects to the previous displayed form.
Now, do we really need a recreateUI method, when there is no stall form exception thrown?
I would say yes. The fact that you don’t see your changes is telling.
Also the fact that you don’t get an error doesn’t denote good behavior in fact the absent of this error I would classify as a bug or at least a diversion of existing behavior.
Anyway, if you want to change a form that is/has been displayed you need to use recreateUI() to show the changes OR use the old way which is to destroy the form yourself and reload it.
Of course to destroy a loaded form it can’t be referenced anywhere (so also not displayed). To work around that you simply show another form, then remove the form from history, destroy/revert the form and make your changes. Then show the form again.
Hope this helps.
Thanks Robert for the clarifications.
Here is the feature request. SVY-4803