Return values on Window Close

I am building my own numeric entry window to meet some special requirements of my customer. I have it working except that I need a clean method for passing the result back to the control that opened the numeric entry window.

The existing built in numeric entry allows you to script a return value such as:
result = system.gui.showNumericKeypad(0)

I would like to use this same type of method using a standard window.

Thanks

The system.gui.showNumericKeypad(0) and inputBox functions popup up modal windows that blocks user input to all other windows in the program. You can’t do that very easily with standard windows in Ignition. Secondly, you can’t make your script hang or block until input has been received from the popup window.

With that aside, you can set a window’s layer property to force the window to stay in view. You can pass in a initial value to display and when the user presses OK you can save the value to a client tag. Once the client tag changes you can finish your script.

You may not want this behavior. You can make the script more involved by running it in its own thread through the system.util.invokeAsynchronous where you can do a loop waiting for the client tag to change. That way you are forcing the script to wait for input back.

Let me know what you think about this. We can help you with the more complicated script.

I ended up using the client tag method and it seems to work okay.