# Confirm on Exit

**URL:** <https://discourse.processing.org/t/confirm-on-exit/20613>\
**Category:** Coding Questions\
**Created:** [May 8, 2020, 2:46am UTC](https://discourse.processing.org/t/confirm-on-exit/20613 "2020-05-08T02:46:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamcdonald](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jamcdonald](https://discourse.processing.org/u/jamcdonald)\
**Post date:** [May 8, 2020, 2:46am UTC](https://discourse.processing.org/t/confirm-on-exit/20613/1 "2020-05-08T02:46:48Z")

</div>

I am trying to make a program where when the X button is clicked, the user is prompted Would you like to save before quitting? Save, Dont Save, Cancel.  
The problem is, I cant figure out how to cancel closing the window. I tried overriding the exit function, but no matter what I try, the X always closes the program when clicked.  
How do I do the cancel option?

---

<div class="post-metadata">

**Author:** ![KevinWho](https://avatars.discourse-cdn.com/v4/letter/k/dbc845/32.png) [@KevinWho](https://discourse.processing.org/u/KevinWho)\
**Post date:** [May 8, 2020, 4:38am UTC](https://discourse.processing.org/t/confirm-on-exit/20613/2 "2020-05-08T04:38:41Z")

</div>

Try looking here:  
[https://processing.org/discourse/beta/num\_1244576974.html](https://processing.org/discourse/beta/num_1244576974.html)

---

<div class="post-metadata">

**Author:** ![jamcdonald](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jamcdonald](https://discourse.processing.org/u/jamcdonald)\
**Post date:** [May 8, 2020, 5:21am UTC](https://discourse.processing.org/t/confirm-on-exit/20613/3 "2020-05-08T05:21:35Z")

</div>

Thanks! That should do the trick.
