Up   Previous   Next  

Terminating MLTE

You need to call the TXNTerminateTextension function when you terminate your application. Listing 3-4 shows how you can terminate MLTE when your application quits. You should first check to make sure all the document windows are closed and the Font Menu object is disposed of before you terminate MLTE so that your application quits gracefully.

Listing 3-4 Terminating MLTE in your application's termination function
void MyTerminate () { WindowPtr theWindow; Boolean closed; closed = true; do { // Call the Window Manager function to get the current front window. theWindow = FrontWindow (); // If there is an open window if (theWindow != NULL) // call your function to close the window. closed = MyDoCloseWindow (theWindow); } // Keep closing windows until they are all closed. while (closed && (theWindow != NULL)); // If all the windows are closed if (closed) { // and if a Font Menu object exists, if (gTXNFontMenuObject != NULL) { OSStatus status; // call the MLTE function to dispose of the Font menu object. status = TXNDisposeFontMenuObject (gTXNFontMenuObject); // If there is an error if (status != noErr) // call your function to handle the error. MyAlertUser (eNoDisposeFontMenuObject); //Set the Font menu object to NULL even if there is an error. gTXNFontMenuObject = NULL; } } // Call the MLTE function to terminate MLTE. TXNTerminateTextension (); // Call the Process Manager function to exit your application. ExitToShell (); }

Copyright © 2001 Apple Computer, Inc. (Last Updated January 11, 2001)

Up   Previous   Next