Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Environment and Utilities /
Chapter 3 - Errors, Warnings, and Notices / Using Errors, Warnings, and Notices


Changing the Error, Warning, or Notice Posted

You can use the GXPostGraphicsError, GXPostGraphicsWarning, and GXPostGraphicsNotice functions to post your own errors, warnings, and notices from inside your application.

Note
Notices are posted only in the debugging version of QuickDraw GX.
The GXPostGraphicsError function replaces the current QuickDraw GX error with any error message you provide as the error parameter. The error you substitute may be one of the QuickDraw GX errors or your own error message. This function stores the new error message so that subsequent calls to GXGetGraphicsError return the error substituted by this function.

Listing 3-4 shows the use of the GXPostGraphicsError function to change the posted error to an error having the name special_user_error and the error number 2097152. This is the gxFirstAppError constant.

Listing 3-4 Changing the error posted

static long SampleCode4(void)
{
   #define special_user_error 2097152L
   #define end_of_file -1L
   long myFilePosition = 0;

/* block of application code */

   if( myFilePosition == end_of_file ) {

/* indicate that an error occurred */

      PostGraphicsError(special_user_error);
   }

   /* block of application code */

/* 
You need to check for errors only once; this will catch errors 
generated by QuickDraw GX and any user-defined errors that were 
posted. 
*/

   {  graphicsError myError;
      if( myError = GXGetGraphicsError(nil) )
         return myError;
   }

   /* block of application code */

}
The GXPostGraphicsError function is described on page 3-55. The QuickDraw GX errors are listed in the section "Errors" beginning on page 3-6.

The GXPostGraphicsWarning function replaces the current QuickDraw GX warning with any warning message you provide as the warning parameter. The warning you substitute may be one of the QuickDraw GX warnings or your own warning message. This function stores the new warning message so that subsequent calls to GXGetGraphicsWarning return the warning substituted by this function.

The GXPostGraphicsWarning function is described on page 3-59. The QuickDraw GX warnings are listed in the section "Warnings" beginning on page 3-10.

The GXPostGraphicsNotice function replaces the current QuickDraw GX notice with any notice message you provide as the notice parameter. The notice you substitute may be one of the QuickDraw GX notices or your own notice message. This function stores the new notice message so that subsequent calls to GXGetGraphicsNotice return the notice substituted by this function.

The GXPostGraphicsNotice function is described on page 3-65. The QuickDraw GX notices are listed in the section "Notices" beginning on page 3-27.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996