Search This Blog

Pages

Articles

    How To Make Your App Quit

    A user of your Mac OS X app will be able to quit at any time by choosing Quit from the application menu or pressing Command-Q. But there are times when you may want your app to quit programatically, such as when the user clicks a Quit button that you have created within your app.

    Fortunately, the Macify Runtime has functionality to receive a Quit command from your app and will immediately shut down upon receiving it.

    This is accomplished by your Clickteam Fusion app calling the javascript "quit()" function from within the event editor.

    You can call this function using the HTML5 Object inside Clickteam Fusion. When your app is ready to quit, on the HTML5 Object, call the following sequence of commands:


    • Reset Parameters
    • Add String Parameter "quit()"
    • Call Function "eval"

    This will call the javascript quit() function from the hosting page, which the Macify runtime will interpret and quit. Make sure you have saved any data to INI files or to a remote server prior to calling these commands or the data will be lost. 

    You can see this in action in the sample project included with Macify. Here is a screenshot of the events in question.