Modal Pop-Up How-To?

So you want to create a popup window that users can’t click off of and stays above the parent window? Sorry, not really familiar with the term.

Here’s what I came up with:

  1. The first part would be clicking on the popup window and setting the layer above the layer of the parent window. That should keep it on top of the parent until the user closes the window. It won’t filter clicks though, we’ll get to that.

  2. Then turn off close-able so the X doesn’t display at the top. Turn off resizeable, and turn off maximizable.

  3. Then in internal frame deactivated for the popup make it center the window using the script builder (make sure it doesn’t open another instance). Go into the script editor and do. This make the window recenter and refocus if the user clicks off. You probably want to make sure the window always caches.

try:
list(system.gui.getOpenedWindows()).index(‘WINDOWNAME’)
centerthewindow()
except:
“” #If you don’t do this when you close the window but click something else the popup will reopen.

  1. Then on frame activated open a second popup window with a layer higher than the root container but not higher than the popup we want. No titlebar or border, with an invisible transparent root container. This will sponge clicks off of our modal window. You can add a Windows ding with system.util.beep(), if you so wish. (Please don’t.).

  2. For our modal window we want to open and close our invisible window on the InternalFrame ActivatedDeactivated of our modal window.

  3. I would try and do something with binding the name to the root container so you don’t have to change the window name in the scripts every time you want to re-use it.

If you want to Cellophane over the other window or whatever:

You need to make the root container of your click blocker window an opaque color, and then in the visionWindowOpened put this script in.

window = system.gui.getParentWindow(event)
window.setOpaque(0)

Result: