For some reason I closed the window to quit on windows and the menu to close on Mac. Sigh. My error is on both platforms…
The problem is that the example code I stole and put in the window cancelclose event does not actually close the app, just the window after running the message dialogue.
So I tried adding quit, but when I do the quit retriggers itself and the (save, don’t save, cancel) dialogue, shows up twice.
(If I quit via the drop down menu it works as it should, just the dialogue once and then it quits.)
When quitting by closing the window. Do I use quit to kill the process? And where do I put it, to get rid of the message dialogue showing itself twice?
I tried to move “quit” to the close event, but the result is the same.
[code]Dim md as New MessageDialog //declare the MessageDialog object
Dim mb as MessageDialogButton //for handling the result
md.icon=MessageDialog.GraphicCaution //display warning icon
md.CancelButton.Visible=True //show the Cancel button
md.AlternateActionButton.Visible=True //show the “Don’t Save” button
md.Message=“Do you want to save changes to this document before closing?”
md.Explanation="If you don’t save, your changes will be lost. "
mb=md.ShowModal //display the dialog
Select Case mb //determine which button was pressed.
//user pressed Save
'code '***RETRIGGERS ITSELF IN SOME WAY AND MAKES THE QUIT DIALOGUE SHOW TWICE
Return True 'just skip out
//user pressed Don’t Save
’ some code before qutting
quit '***RETRIGGERS ITSELF IN SOME WAY AND MAKES THE QUIT DIALOGUE SHOW TWICE
//user pressed Cancel
(All there is in Menu Handels / Quit, is quit.)
Later: Rephrasing my search I now found that this problem is ancient… Still trying to find a solution…
Later2: OK. Quit (in the dropdown menu) fires Application CancelClose Event, then Window CancelClose Event (when closing the window). Trying to close the Window fires only Window CancelClose Event. By adding quit to the window CancelClose Event, then the Application CancelClose event is fired, then… So I got figure things out how to move things around to not get things done more than once, to get around Xojo being helpful and doing things for me…