View Full Version : Windows Clost Button in AMS 7.5
u863583
03-03-2009, 10:51 AM
I have looked through forums, but am failing to find any code to do this. I need to trap when a user clicks the "X" close button at the top right of the program so that I can perform some house-cleaning before exiting.
Does some code need to be places on each page, or is there a global way to trap this. I this done with a click or key event on the page? Any help would be most appreciated.
thanks
Manny
Dermot
03-03-2009, 11:04 AM
Use the On Shutdown event.
u863583
03-03-2009, 11:08 AM
Thank you for reply. Also just found on the forum this code that when placed on the Global section also traps hitting the close button. I will take a look at the event.
--------------------------------------
function QueryAllowProjectClose()
result= Dialog.Message("Application Exit", "Are you sure that you want to quit?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
--if they choose yes
if result == IDYES then
--allow the app to close
return true;
else
--cancel close
return false;
end
end
Dermot
03-03-2009, 11:21 AM
That function is useful if you want to prevent it from being closed or you want the user to confirm. If you just want to do some clean up the the On Shutdown event is the easiest.
u863583
03-03-2009, 12:22 PM
Hi Dermot,
Yes, I agree. You are correct. Issue was I was not even aware that event was there. Found it under Project/Actions section. Always thought it should exist, just did'nt know where it was or forgot about it over the years. For what I am doing that is the correct event. Exactly what I needed.
thanks again and regards,
Manny
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.