I'm working on a script with a dialog box in photoshop. The goal is to get an End Date and Time for multiple banners.
My Cancel button works fine, but my Ok button produces a weird bug. The window appears to close, but simply disappears. Since it's a dialog, Photoshop remains frozen while waiting for the dialog to close. CMD+Tab reveals the window which I can click into. After that - the OK button does not close the window (the rest of the code inside the callback still gets called), but the Cancel button does close the window fine.
(Video showcasing the bug: https://drive.google.com/open?id=12W6J15ap52xq1jKbVPt2-XeyIxumx6Qd )
My callback functions are as follows:
var cancelled = false;
dateWin.onClose = function(){
return cancelled;
}
dateBtnCancel.onClick = function(){
cancelled = true;
return dateWin.close();
}
dateBtnOK.onClick = function(){
cancelled = false;
return dateWin.close();
}
dateWin.show();
alert(cancelled);
Any assistance or suggestions would be appreciated. Thank you!
UPDATE Disabling my onClose callback fixes this issue - but more importantly I don't know why this fixes the issue. Understanding what's going on here can help me not make the same mistake in the future, so if you understand why the onClose callback caused this, I would definitely appreciate the explanation.
cancelled
? Judging by your video you don't need that complexity