We're having reports that on one of our systems we're having an issue where a system.gui.confirm() popup is getting behind the Ignition display and silently locking out the screen. In order to be able to do anything we need to Alt-Tab to the confirm popup and close it.
Is there a way to automatically close/cancel system.gui.confirm() through scripting (for example, if they don't push yes within five minutes it automatically closes)?
You can’t use scripting because those popups stop the GUI thread. So almost all other scripts won’t run, either.
Just don’t use system.gui.confirm(). At all. (Nor any of the system.gui.*Box functions.) Make a real popup window for such user interaction. Use window z-order to keep them on top if necessary. Regular popup windows allow scripts to keep running, and can’t get behind the application window.
Good to know. This seems to be another of the “even though Ignition makes it an option, you shouldn’t ever do it” things. It would be nice if the documentation had these disclaimers included.
Would you still recommend not using these popups? Both the confirm and the message boxes seem to open and occasionally loose focus and lock up ignition. Should we create pop up screens or have you learned a work around here? Thanks.
I avoid those modal popup functions entirely. Use actual popup windows and do not rely on a return value in the script that opens the popup.
For most effective re-use, I recommend placing function objects/lambas into the opened popup using Swing's .putClientProperty(), and have the popup's response buttons call those function objects.