Expand my Community achievements bar.

Stop Initialize for Subforms that are invisible

Avatar

Former Community Member
Is there a way to stop the objects within a subform from initializing?



I have subforms with a lot of objects in them but it seems everything initializes.
7 Replies

Avatar

Level 4
In short, no.



You can however move your script to one of the other events such as calculate which will trigger when the subform is made visible. You could then wrap your script in an if statement that will onyl run when the subform is visible (subform.presence == "visible").

Avatar

Former Community Member
I tried the wrapper in the initialize but it cuases more issues but can reconfigure the script to the calculate to see if it works out. If I am changing visuals like the x y coordinates, visibility, etc. wil the calculate redraw the form?

Avatar

Level 4
The initialise will only trigger when the subform is first created. You can however trigger it to go again by using:



subForm.execInitialize();



I would think that it would work and redraw the form but haven't tried it out. I would also think that it would cause the calculate script to fire AGAIN after it had redrawn the form as that would be part of the layout process.



Tom

Avatar

Former Community Member
So if I need to initialize the form to redraw it and it causes the calculate event to fire - there is no benefit to move the script right?

Avatar

Level 4
What I'm saying is that you could leave the script where it is, but start the initialise event again whenever you choose. The initialise will only run once (whenever you open the form at first), unless you tell it to run again.

Avatar

Former Community Member
Is there a way to redraw elements of the form wihtout execInitialize();?



Does resolveNode do thing instantly?

xfa.resolveNode("Form.combobox.ui.#choiceList.border.fill.color").value = "255,255,255";



And does the following require a redraw?

Form.combobox.ui.choiceList.border.fill.color.value = "255,255,255";



if so, maybe I can change my script to use resolveNode

Avatar

Level 4
xfa.layout.relayout();



I have no idea about the other two, you'll have to test them yourself.



Tom