Enter Custom Code Save Confirmation when Cancel is pressed or Cross is clicked

Not sure if anyone ever done a lot of code and then accidentally pressed the cross or Cancel button?

I have spent a lot of time entering some custom code and after I Check Syntax, a pop up saying OK. I thought that would save the work, but guess NOT. If you press the cross or Cancel by accident, you will lose all the work. I hope Epicor can just add a confirmation box to prevent loss of work.

image