How to prevent user from closing pop up window until neccessary action has been taken

hello guys,
I have a use case where when an alarm is triggered a pop up window appears (see image). I want the user to enter a comment in the comment box shown and select a reason for the alarm from the drop down before he can close the popup.

How do I prevent the user from closing the popup window if either the comment box has not been filled or dropdown has not been selected? would this be a script in the ‘visionwindowclosed’ section? Thanks

How is the user initiating the close of the window? With the Button?

If it is in the button then just test for your requirements in the ActionPerformed event of the button.

comment = event.source.parent.getComponent("path to comment box").text
reason = event.source.parent.getComponent("path to reason dropdown").selectedValue

if len(comment) > 0 and reason != -1:
   system.nav.closeWindow("path to popup")
   system.gui.messageBox("You must provide a comment and reason")

In addition to this you can bind the enabled property of the button to something like

len({Root Container.commentBox.text})>0 && {Root Container.dropDownRason.selectedValue}>-1

I think you may want to uncheck the Closeable property on the popup behavior as well -

This gets rid of the little X in the top right so they can’t just close it that way.