8.0.9 VisionWindowOpen Invoke Later Issue

I have a script n the ViaionWindowOpen event and have the radio button ticked for Invoke Later. What I am finding is that the script is running immediately and it is throwing errors. If I copy the script to a push button and run it there are no errors. Can anyone offer any ideas?

Thanks,

Frank

Are you giving the invoke later function a delay value? Without seeing your code it’s hard to determine the cause.

1 Like

My script is inside the vision window opened event. Below the script in the dialog boxes there is simply a checkbox for invoke later, there is no place to enter a delay time that I see

The various tabs in the event editor just auto-write a script for you. Flip to the last tab to see what the actual script looks like, and edit to suit. Or copy that real script and paste here for us to critique. Please use a line with three backquotes (these: ```) above the pasted code, and again below the pasted code, to trigger forum code formatting. (Or we won’t be able to see your indentation.)

1 Like

Hi Phil,

I have included a picture that shows the code and the invoke later selection ticked.

You’ll have to use system.util.invokeLater yourself, with a delay. Which will require you to nest most of the operations shown in a function definition.

Also, consider optimizing your script with temporary variables so you don’t repeatedly call getComponentForPath() on the same item. Also, in this event, system.gui.getParentWindow(event) returns the same value that is already supplied as event.source. Just use event.source.

Finally, reading tags via script in an event routine requires callouts to the gateway that can freeze your UI if there are any hiccups. Consider just using indirect bindings on the Easy Chart’s properties to connect them to the tags in the UDT.