Hi,
I have a problem with this function.
My situation is:
I have a form in wich there are many label/button,so can happens that this object became overlapped.
In this way I have thinked to use the property “formIndex” to solve this problem.
the property work fine but when I call the function “form.myform.controller.recreateUI()” then the current location of my object is lost.
for example:
I have this start situation:
[attachment=2]starting.JPG[/attachment]
so I activate the design mode and move the button1 to overlap the button2 and at the same time I set the formIndex
[attachment=1]acrivate_design.JPG[/attachment]
after this I make the update(recreateUI()) to make the changes became real;
when I do that the formIndex are correctly updated but the button1 returns to it’s start position.
I have attacched a sample solution to reproduce it.
Thanks in advance
Marco
Windows xp,servoy 5.1.2 ,java 6 update 20
test_fromIndex.servoy (4.74 KB)
do you save the positions also in the solution model object of that button?
Design mode doesnt do that for you, you have to make it persistent (in the session)
In the sample solution, the formIndex1 and formIndex2 variables of the main form are never modified!
function onActionUpdate(event) {
forms.sub.controller.setDesignMode(globals.onDrag,globals.onDrop,globals.onSelect,globals.onResize)
var _button1 = solutionModel.getForm('sub').getButton('button1')
_button1.formIndex = formIndex1
var _button2 = solutionModel.getForm('sub').getButton('button2')
_button2.formIndex = formIndex2
forms.sub.controller.setDesignMode(false)
forms.sub.controller.recreateUI();
}
why do you have to call recreateUI()?
@madimane
In the sample solution, the formIndex1 and formIndex2 variables of the main form are never modified!
to test the formIndex I have used two local variable to perform more test without restarting servoy.The variables can be changed by the textfield.
do you save the positions also in the solution model object of that button?
Design mode doesnt do that for you, you have to make it persistent (in the session)
Yes but I prefer to have not to recreate all every time that I have to bring to front one button/label.
However,maybe I have solved my problem,If it work I’ll post here the solution
Thanks
Marco
I have solved this problem by removing and than recreating the button every time that I move it ,so when I call the recreateUI I obtain what I want:I have changed the the formIndex and I haven’t lost the button position.