Controlling Quit routine in standalone
I'm trying to make my standalone behave like a real app--in that closing or quiting brings up a "Save Changes" dialog. (My files are text files created and written in a coll object.) I've gotten close by using menubar and creating my own File menu with all the appropriate commands. Then after building the app, I delete the original file menu in the maxinterface.json file. The only glich is that the original Quit command is still in the application menu. Does anyone know how to delete items from the application menu? Or does anyone have a better idea? The "dirty" flag to thispatcher only applies to the patcher itself but I'm trying to flag and update the file stored in the coll object.
Take a look at the [closebang] object. You can use that to trigger display of a dialog window that you yourself can create that will allow the user to save (or not) the coll info.
Dan
Thanks for the reply. I'm already using the closebang object in my routine that checks for changes to the text file. Everything works. The Achilles heel is that I still have a "Quit" item in the application menu that I can't program. I put a "Quit" item in my file menu that does run the routine and it has the command-Q macro attached to it. I suppose I'll just have to warn the user that the "Quit" command in the app menu doesn't check for changes. Meanwhile I'm reading a book on objective C to learn how to build my app from scratch.
In your final standalone, take a look at the maxinterface.json file. Make a copy of the original one named something different, and then feel free to hack the original one. Look towards the bottom of the file, at the section called "menubar", and "menus_menubar_mac" (and/or "menus_menubar_windows") within it. That will give you some clues as to where to make changes...
Dan
Hi Dan,
I was just wondering if you could point me a little bit more specifically towards what to do in the json file? I'm trying to do what kgoold did - add a custom quit and then link it to Command Q and then take out the original Quit command - but I don't need to have it do anything as complicated as open a save dialog. I just need to delay a user's quit command long enough to send a couple of bangs (trigger a couple messages to a hardware unit) before the app quits. Unfortunately, I already tried this with closebang and the app closed before the messages could be sent. I looked at menus_menubar_mac and I took the quit entry out of the customapplmenu and no dice - it still appeared in my standalone. Any help very much appreciated, thanks!
-Diane
Interesting - I just tried it myself, and could not get rid of it either. It looks like it the quit command is not delete-able... Sorry I can't help on this one, maybe someone else will come to the rescue!