I have created an application and I had a question about how to control closing the application. In the application you can close it by pressing the 'x' button on the top right hand of the window or by choosing the file menu and pressing 'exit'. Now i need to do some stuff before the application closes, which in fact determines whether the application will indeed close or the action will be discarded.
I have attached a simple vi and runtime menu to demonstrate my case
To discard the 'x' button i have placed and event loop with the 'Panel close?' case, however i could not get this to work with the 'Exit' option in the file menu. The 'Exit' can be discarded if i place an 'Application Instance Close?' event case but then i would have to repeat eveything i did in the 'Panel close?' case here again which i prefer not to do since it doesn't look that clean.
I tried changing the 'Exit' in the file menu to a 'user item' instead of an 'application item' and close the application with a case structure, as you can see in the attached vi, but it didn't help. It would close the panel and not enter the 'Panel close?' event case
Again my basic point is that i am trying to control exiting the application, instead of exiting it right away i want to do a bunch of stuff and then decide whether the applicaiton can be exited or more work is required. As you can see the vi or application works for now but i was wondering whether there was a better way i might have missed
I hope i have been clear enough.
Thanks
Reza
PS i had to change the extension of the menu from rtm to txt to attach the file, please change it back when you have downloaded it