Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Stop Initialize for Subforms that are invisible

Not applicable
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
Thomas_McConnac
Level 4
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").
Not applicable
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?
Thomas_McConnac
Level 4
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
Not applicable
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?
Thomas_McConnac
Level 4
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.
Not applicable
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
Thomas_McConnac
Level 4
Level 4
xfa.layout.relayout();



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



Tom