Open AbstractLookup modal screen programmatically as a dialog while "blocking" code execution ?

I have a modal screen (defined as dialog, modal in xml).
I call it programatically on a button click from a parent screen with the code below:

My code:
openWindow(“xxx$MyWindow.browse”, WindowManager.OpenType.DIALOG, params);
showMessageDialog("", “blah blah”, MessageType.WARNING);

Modal screen seems to return code execution to the parent screen where it was called from, before the user closes it because the message ‘blah blah’ appears immediately after the screen is loaded and visible. Am I missing something ?


You need to place your showMessageDialog inside a close listener, for example:

openWindow("xxx$MyWindow.browse", WindowManager.OpenType.DIALOG, params)
	.addCloseListener(actionId -> 
			showMessageDialog("", "blah blah", MessageType.WARNING));




Thank you very much!