There doesn't appear to be a way to capture that in a normal dialog.
Just an idea!
I haven't tested this, but Im thinking there is a possibility you can use the sclick event of your 'Ok' button to check before it closes the dialog.
on *:dialog:wtfb:sclick:5:halt
Will the dialog still close if it's halted like this? If halt does stop it from closing then the idea would be to check to make sure your requirements are met, if not halt, otherwise let the dialog close.