home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / C Reference Card 2.3 / C Reference Card / C Reference Card.rsrc / TEXT_415_15.txt < prev    next >
Encoding:
Text File  |  1995-11-14  |  18.9 KB  |  749 lines

  1. PROGRAMMING THE MAC : about, compiler, references, sample application
  2. _________________________________________________________________________
  3.  
  4.  
  5. ABOUT THIS SECTION
  6.  
  7. This section does NOT provide a detailed explanation on how to program for the Macintosh.  There are other (and better) sources for this type of information.  What this section DOES provide is a suggested approach for learning how to start programming for the Macintosh and what sort of tools and documentation you'll need based on personal experience.  Also provided is a sample application which can be used as a reference and a starting point for your own applications.  Learning C or C++ is a fairly straightforward experience.  Attempting the tackle the Toolbox (the function calls which make up the MacOS) can be a much more daunting task.  Try to be patient and don't expect to learn everything in one day.
  8.  
  9. You'd think that learning to program the Macintosh (or any graphical environment) would consist of buying one book, start at the beginning, and a few days later finish the book with a thorough knowledge of everything you needed to know to master the Toolbox.  Well, it simply ain't so.  There are literally volumes of reference material from Apple on all of the Managers which comprise the MacOS.  Managers are groups of related functions.  Examples of which are the QuickDraw Manager, TextEdit Manager, Menu Manager, etc.  There are dozens of Managers and THOUSANDS of functions which comprise the Toolbox.  Very few people can expect to master them all.
  10.  
  11.  
  12.  
  13. PURCHASING A COMPILER
  14.  
  15. There are basically two choices for C/C++ compilers for the Macintosh; Think C by Symantec and Code Warrior by Metrowerks.  Both are similarly priced and both are full-featured compilers.  Think C has been around for longer, but Code Warrior has made major inroads since it's introduction.  Either choice is money well spent.
  16.  
  17. Apple has their own compiler, MPW (Macintosh Programming Workshop), but word is that they are discontinuing it's use and it costs an arm and a leg.
  18.  
  19.  
  20.  
  21. REFERENCE MATERIAL
  22.  
  23. The following is the minimum recommended reference material you should start out with if you intend on programming for the Macintosh:
  24.  
  25. Inside Macintosh: Overview
  26. Inside Macintosh: Macintosh Toolbox Essentials
  27. Inside Macintosh: Imaging with QuickDraw
  28. Symantec THINK Reference
  29. A good C/C++ book
  30.  
  31. There are currently over two dozen "Inside Macintosh" books available from Apple.  You can easily order these books (as well as your compiler) through APDA (Apple Program Developers Association).  While your at it, consider becoming a member of APDA.  APDA can be reached at 1-800-282-2732 or over the net at http://www.info.apple.com/dev.
  32.  
  33.  
  34.  
  35. A COMPLETE SAMPLE APPLICATION
  36.  
  37. The following is a complete application.  It represents watered-down code in that there is limited error-checking and no support for things like AppleEvents, Scripting, or Balloon Help.  However, it does provide the basic event-loop which almost all Macintosh applications are based on.
  38.  
  39. The sample application consists of two files; starter.cp and resources.r
  40.  
  41.  
  42. /************************* Segment: starter.cp **************************
  43.  
  44.   Written using Symantec THINK C 7.0
  45.  
  46.   Assumes inclusion of <MacHeaders++> file, MacTraps library, and ANSI++
  47.   library.
  48.                      
  49.   All functions and sub-routines are identified with an underscore '_' 
  50.   at the end of the function name.  This hopefully helps to identify
  51.   program functions from Toolbox calls.
  52.                 
  53. */
  54.  
  55. /********** Standard Includes */
  56. #include <Types.h>
  57. #include <Quickdraw.h>
  58. #include <Controls.h>
  59. #include <Desk.h>
  60. #include <Dialogs.h>
  61. #include <DiskInit.h>
  62. #include <Editions.h>
  63. #include <EPPC.h>
  64. #include <Events.h>
  65. #include <Fonts.h>
  66. #include <GestaltEqu.h>
  67. #include <Lists.h>
  68. #include <Menus.h>
  69. #include <OSEvents.h>
  70. #include <TextEdit.h>
  71. #include <ToolUtils.h>
  72. #include <Traps.h>
  73. #include <AppleEvents.h>
  74. #include <Balloons.h>
  75.  
  76. /********** Define Statements */
  77. #define kNilPtr             0L
  78. #define kMoveToFront        (WindowPtr)-1L
  79. #define kLeaveIt            false
  80. #define kRemoveEvents       0
  81. #define kSleep              60L
  82. #define kNilMouseRegion     0L
  83. #define kWaitNextEventTrap  0x60
  84. #define kUnimplementedTrap  0x9F
  85. #define kMinimumSysVersion  0x700  // minimum system version required
  86.  
  87. /********** General */
  88. const short kDragThreshold = 30;
  89. const unsigned char *kNilStr = "\p";
  90. const unsigned char *kFatalErrorStr = "\pFatal Error!";
  91.  
  92. /********** Window definitions */
  93. const short kNewWindow =    400;
  94. const short kWindowLeft =   5;
  95. const short kWindowTop =    45;
  96. const short kWindowOffset = 20;
  97.  
  98. /********** Alerts */
  99. const short kAboutAlert =   400;
  100. const short kErrorAlert =   401;
  101.  
  102. /********** Param Text */
  103. const short kGeneralError = 400;
  104. const short kBadSystem =    401;
  105. const short kNoMenuBarRes = 402;
  106. const short kNoMenuRes =    403;
  107. const short kNoWindowRes =  404;
  108.  
  109. /********** Menu Stuff */
  110. const short kMenuBar =      400;
  111. const short kAppleMenu =    400;
  112. const short kFileMenu =     401;
  113. const short kEditMenu =     402;
  114. const short kAbout =        1;
  115. const short kNew =          1;
  116. const short kClose =        2;
  117. const short kQuit =         3;
  118. const short kUndo =         1;
  119. const short kCut =          2;
  120. const short kCopy =         3;
  121. const short kPaste =        4;
  122. const short kClear =        6;
  123.  
  124. /********** Structures */
  125. struct SysConfigRec
  126. {
  127.     Boolean hasGestalt;
  128.     Boolean hasWNE;
  129.     Boolean hasColorQD;
  130.     Boolean hasAppleEvents;
  131.     Boolean hasEditionMgr;
  132.     Boolean hasHelpMgr;
  133.  
  134.     long    sysVersion;
  135. };
  136.  
  137. /********** Global Variables */
  138. Boolean             gDone;
  139. EventRecord         gTheEvent;
  140. MenuHandle          gAppleMenu;
  141. MenuHandle          gFileMenu;
  142. MenuHandle          gEditMenu;
  143. Rect                gDragRect;
  144. short               gAppResourceFile;
  145. struct SysConfigRec gSysConfig;
  146. int                 gNewWindowLeft = kWindowLeft;
  147. int                 gNewWindowTop = kWindowTop;
  148.  
  149. /********** Prototypes */
  150. void main( void );
  151. void ToolBoxInit_( void );
  152. static void GetSysConfig_( void );
  153. Boolean TrapAvailable_( short tNumber, TrapType tType );
  154. void MenuBarInit_( void );
  155. void SetUpDragRect_( void );
  156. void HandleEvent_( void );
  157. void DoMouseDown_( void );
  158. void AdjustMenus_( void );
  159. short IsDAWindow_( WindowPtr w );
  160. void DoMenuChoice_( long int menuChoice );
  161. void DoAppleChoice_( int theItem );
  162. void DoFileChoice_( int theItem );
  163. void DoEditChoice_( int theItem );
  164. void DoCreateWindow_( void );
  165. void ErrorHandler_( int stringNum, int quitFlag );
  166.  
  167.  
  168. /********** main */
  169.  
  170. void main( void )
  171. {
  172.     ToolBoxInit_();
  173.     GetSysConfig_();
  174.     MenuBarInit_();
  175.     SetUpDragRect_();
  176.     DoCreateWindow_();
  177.     
  178.     gDone = false;
  179.     while( gDone == false )
  180.         HandleEvent_();
  181. }
  182.  
  183.  
  184. /********** ToolBoxInit */
  185.  
  186. void ToolBoxInit_( void )
  187. {
  188.     // Standard initialization procedure per IM:Overview p4-75
  189.  
  190.     MaxApplZone();
  191.     MoreMasters();
  192.     
  193.     InitGraf( &thePort );
  194.     InitFonts();
  195.     InitWindows();
  196.     InitMenus();
  197.     TEInit();
  198.     InitDialogs( kNilPtr );
  199.     
  200.     FlushEvents( everyEvent, kRemoveEvents );    
  201.     InitCursor();
  202. }
  203.  
  204.  
  205. /********** GetSysConfig */
  206.  
  207. static void GetSysConfig_( void )
  208. {   
  209.     OSErr        ignoreError;
  210.     long         tempLong;
  211.     SysEnvRec    environs;
  212.     short        myBit;
  213.  
  214.     // set app resource fork ID
  215.     gAppResourceFile = CurResFile();
  216.  
  217.     // check to see if Gestalt Manager is supported
  218.     gSysConfig.hasGestalt = TrapAvailable_( _Gestalt, ToolTrap );
  219.     if( !gSysConfig.hasGestalt )
  220.         // something has got to be wrong
  221.         ErrorHandler_( kGeneralError, true );
  222.     else
  223.     {
  224.         // determine system configuration
  225.  
  226.         gSysConfig.hasWNE = TrapAvailable_( _WaitNextEvent, ToolTrap );
  227.         
  228.         ignoreError = Gestalt( gestaltQuickdrawVersion, &tempLong );
  229.         gSysConfig.hasColorQD = ( tempLong != gestaltOriginalQD );
  230.         
  231.         gSysConfig.hasAppleEvents = ( Gestalt( gestaltAppleEventsAttr,
  232.             &tempLong ) == noErr );
  233.  
  234.         gSysConfig.hasEditionMgr = ( Gestalt( gestaltEditionMgrAttr,
  235.             &tempLong ) == noErr );
  236.         if( gSysConfig.hasEditionMgr )
  237.             if( InitEditionPack() != noErr )
  238.                 gSysConfig.hasEditionMgr = false;
  239.                 
  240.         ignoreError = Gestalt( gestaltHelpMgrAttr, &tempLong );
  241.         myBit = gestaltHelpMgrPresent;
  242.         gSysConfig.hasHelpMgr =
  243.             BitTst( &tempLong, 31 - myBit );
  244.             
  245.         gSysConfig.sysVersion = 0.0;
  246.         ignoreError = Gestalt( gestaltSystemVersion, &tempLong );
  247.         gSysConfig.sysVersion = tempLong;
  248.         if( kMinimumSysVersion > gSysConfig.sysVersion )
  249.             ErrorHandler_( kBadSystem, true );
  250.     }
  251. }
  252.  
  253.  
  254. /********** TrapAvailable */
  255.  
  256. Boolean TrapAvailable_( short tNumber, TrapType tType )
  257. {
  258.     return( NGetTrapAddress( tNumber, tType ) 
  259.     != GetTrapAddress( _Unimplemented ) );
  260. }
  261.  
  262.  
  263. /********** MenuBarInit */
  264.  
  265. void MenuBarInit_( void )
  266. {
  267.     Handle  myMenuBar;
  268.  
  269.     if( ( myMenuBar = GetNewMBar( kMenuBar ) ) == kNilPtr )
  270.         ErrorHandler_( kNoMenuBarRes, true );
  271.     SetMenuBar( myMenuBar );
  272.     
  273.     gAppleMenu = GetMHandle( kAppleMenu );
  274.     gFileMenu = GetMHandle( kFileMenu );
  275.     gEditMenu = GetMHandle( kEditMenu );
  276.     if( gAppleMenu == kNilPtr || gFileMenu == kNilPtr || 
  277.       gEditMenu == kNilPtr ) ErrorHandler_( kNoMenuRes, true );
  278.     AddResMenu( gAppleMenu, 'DRVR' );
  279.     DrawMenuBar();
  280. }
  281.  
  282.  
  283. /********** SetUpDragRect */
  284.  
  285. void SetUpDragRect_( void )
  286. {
  287.     gDragRect = screenBits.bounds;
  288.     gDragRect.left += kDragThreshold;
  289.     gDragRect.right -= kDragThreshold;
  290.     gDragRect.bottom -= kDragThreshold;
  291. }
  292.  
  293.  
  294. /********** HandleEvent */
  295.  
  296. void HandleEvent_( void )
  297. {
  298.     char      theChar;
  299.     GrafPtr   oldPort;
  300.     WindowPtr w;
  301.     
  302.     if( gSysConfig.hasWNE )
  303.         WaitNextEvent( everyEvent, &gTheEvent, kSleep, kNilMouseRegion );
  304.     else
  305.     {
  306.         SystemTask();
  307.         GetNextEvent( everyEvent, &gTheEvent );
  308.     }
  309.  
  310.     switch( gTheEvent.what )
  311.     {
  312.         case mouseDown: 
  313.             DoMouseDown_();
  314.             break;
  315.         case mouseUp:
  316.             // this application doesn't use mouseUp events
  317.             break;
  318.         case keyDown:
  319.         case autoKey:
  320.             theChar = gTheEvent.message & charCodeMask;
  321.             if(( gTheEvent.modifiers & cmdKey ) != 0)
  322.             {
  323.                 AdjustMenus_(); 
  324.                 DoMenuChoice_( MenuKey( theChar ) );
  325.             }
  326.             else
  327.             {
  328.                 /* Handle text from keyboard */
  329.             }
  330.             break;
  331.         case updateEvt:
  332.             if( !IsDAWindow_( (WindowPtr)gTheEvent.message ) )
  333.             {
  334.                 w = (WindowPtr)gTheEvent.message;
  335.                 GetPort( &oldPort );
  336.                 SetPort( w );
  337.                 BeginUpdate( w );
  338.  
  339.                     // perform and update/drawing here
  340.  
  341.                 EndUpdate( w );
  342.                 SetPort( oldPort );
  343.             }
  344.             break;
  345.         case diskEvt:
  346.             // most applications don't need to worry about diskEvt's
  347.              break;
  348.         case activateEvt:
  349.             // this application doesn't need to worry about activateEvt's
  350.             if( !IsDAWindow_( (WindowPtr)gTheEvent.message ) )
  351.             {
  352.                 if( gTheEvent.modifiers & activeFlag )
  353.                 {
  354.                     /* Handle activate event. */
  355.                 }
  356.                 else
  357.                 {
  358.                     /* Handle deactivate event. */
  359.                 }
  360.             }
  361.             break;
  362.         case osEvt:
  363.             // this application doesn't support operating sys events
  364.             break;
  365.         case nullEvent:
  366.             // ignore
  367.             break;
  368.      /*
  369.         case kHighLevelEvent:
  370.             // this application doesn't support high level events
  371.             // need to #include <Events.h> to define kHighLevelEvent
  372.             break;
  373.      */
  374.     }
  375. }
  376.  
  377.  
  378. /********** DoMouseDown */
  379.  
  380. void DoMouseDown_( void )
  381. {
  382.     WindowPtr   w;
  383.     short int   thePart;
  384.     long int    menuChoice;    
  385.     Point       theLocation;
  386.     
  387.     thePart = FindWindow( gTheEvent.where, &w );
  388.     switch( thePart )
  389.     {
  390.         case inMenuBar:
  391.             AdjustMenus_();
  392.             menuChoice = MenuSelect( gTheEvent.where );
  393.             DoMenuChoice_( menuChoice );
  394.             break;
  395.         case inSysWindow: 
  396.             SystemClick( &gTheEvent, w );
  397.             break;
  398.         case inContent:
  399.             if( w != FrontWindow() )
  400.                 SelectWindow( w );
  401.             else if( !IsDAWindow_( (WindowPtr)gTheEvent.message ) )
  402.                 /* Handle click in window content */ ;
  403.             break;
  404.         case inDrag: 
  405.             DragWindow( w, gTheEvent.where, &gDragRect );
  406.             break;
  407.         case inGrow:
  408.             // not used in this application
  409.             break;
  410.         case inGoAway:
  411.             theLocation = gTheEvent.where;
  412.             GlobalToLocal( &theLocation );
  413.             if( TrackGoAway( w, theLocation ) )
  414.                 DisposeWindow( w );
  415.             break;
  416.         case inZoomIn:
  417.         case inZoomOut:
  418.             // not used in this application
  419.             break;
  420.     }
  421. }
  422.  
  423.  
  424. /********** AdjustMenus */
  425.  
  426. void AdjustMenus_( void )
  427. {
  428.     WindowPtr w;
  429.  
  430.     if(IsDAWindow_( FrontWindow() ) )
  431.     {
  432.         EnableItem( gEditMenu, kUndo );
  433.         EnableItem( gEditMenu, kCut );
  434.         EnableItem( gEditMenu, kCopy );
  435.         EnableItem( gEditMenu, kPaste );
  436.         EnableItem( gEditMenu, kClear );
  437.     }
  438.     else
  439.     {
  440.         DisableItem( gEditMenu, kUndo );
  441.         DisableItem( gEditMenu, kCut );
  442.         DisableItem( gEditMenu, kCopy );
  443.         DisableItem( gEditMenu, kPaste );
  444.         DisableItem( gEditMenu, kClear );
  445.     }
  446.         
  447.     if( ( w = FrontWindow() ) == kNilPtr )
  448.         DisableItem( gFileMenu, kClose );
  449.     else
  450.         EnableItem( gFileMenu, kClose );
  451. }
  452.  
  453.  
  454. /********** IsDAWindow */
  455.  
  456. short IsDAWindow_( WindowPtr w )
  457. {
  458.     if( w == kNilPtr )
  459.         return( false );
  460.     else /* DA windows have negative windowKinds */
  461.         return( ( (WindowPeek)w )->windowKind < 0 );
  462. }
  463.  
  464.  
  465. /********** DoMenuChoice */
  466.  
  467. void DoMenuChoice_( long int menuChoice )
  468. {
  469.     int    theMenu;
  470.     int    theItem;
  471.     
  472.     if( menuChoice != 0 )
  473.     {
  474.         theMenu = HiWord( menuChoice );
  475.         theItem = LoWord( menuChoice );
  476.         switch( theMenu )
  477.         {
  478.             case kAppleMenu :
  479.                 DoAppleChoice_( theItem );
  480.                 break;
  481.             case kFileMenu :
  482.                 DoFileChoice_( theItem );
  483.                 break;
  484.             case kEditMenu :
  485.                 DoEditChoice_( theItem );
  486.                 break;
  487.         }
  488.         HiliteMenu( 0 );
  489.     }
  490. }
  491.  
  492.  
  493. /********** DoAppleChoice */
  494.  
  495. void DoAppleChoice_( int theItem )
  496. {
  497.     Str255  accName;
  498.     int     accNumber;
  499.     
  500.     switch( theItem )
  501.     {
  502.         case kAbout : 
  503.             NoteAlert( kAboutAlert, kNilPtr );
  504.             break;
  505.         default :
  506.             GetItem( gAppleMenu, theItem, accName );
  507.             accNumber = OpenDeskAcc( accName );
  508.             break;
  509.     }
  510. }
  511.  
  512.  
  513. /********** DoFileChoice */
  514.  
  515. void DoFileChoice_( int theItem )
  516. {
  517.     WindowPtr   w;
  518.  
  519.     switch( theItem )
  520.     {
  521.         case kNew :
  522.             DoCreateWindow_();
  523.             break;
  524.         case kClose :
  525.             if( ( w = FrontWindow() ) != kNilPtr )
  526.                 DisposeWindow( w );
  527.             break;
  528.         case kQuit :
  529.             gDone = TRUE;
  530.             break;
  531.     }
  532. }
  533.  
  534.  
  535. /********** DoEditChoice */
  536.  
  537. void DoEditChoice_( int theItem )
  538. {
  539.     if( SystemEdit( theItem - 1 ) == 0 )
  540.     {
  541.         /* Add Edit menu switch statement here */
  542.     }
  543. }
  544.  
  545.  
  546. /********** DoCreateWindow */
  547.  
  548. void DoCreateWindow_( void )
  549. {
  550.     WindowPtr    w;
  551.     
  552.     w = GetNewWindow( kNewWindow, kNilPtr, kMoveToFront );
  553.     if(((screenBits.bounds.right - gNewWindowLeft) < kDragThreshold) ||
  554.         ((screenBits.bounds.bottom - gNewWindowTop) < kDragThreshold))
  555.     {
  556.         gNewWindowLeft = kWindowLeft;
  557.         gNewWindowTop = kWindowTop;
  558.     }
  559.     MoveWindow( w, gNewWindowLeft, gNewWindowTop, kLeaveIt );
  560.     gNewWindowLeft += kWindowOffset;
  561.     gNewWindowTop += kWindowOffset;
  562.     ShowWindow( w );
  563. }
  564.  
  565.  
  566. /********** ErrorHandler */
  567.  
  568. void ErrorHandler_( int stringNum, int quitFlag )
  569. {
  570.     StringHandle   errorStringH;
  571.     
  572.     if( ( errorStringH = GetString( stringNum ) ) == kNilPtr )
  573.         ParamText( kFatalErrorStr, kNilStr, kNilStr, kNilStr );
  574.     else
  575.     {
  576.         HLock( (Handle)errorStringH );
  577.         ParamText( *errorStringH, kNilStr, kNilStr, kNilStr );
  578.         HUnlock( (Handle)errorStringH );
  579.     }
  580.     StopAlert( kErrorAlert, kNilPtr );
  581.     if( quitFlag )
  582.         ExitToShell();
  583. }
  584.  
  585.  
  586. /************************* Segment: resources.r ************************/
  587.  
  588. /* THINK Rez resource format */
  589.  
  590. #include <Types.r>
  591.  
  592. resource 'WIND' (400, "Main WIND") {
  593.     {45, 5, 205, 181},
  594.     noGrowDocProc,
  595.     invisible,
  596.     goAway,
  597.     0x0,
  598.     "Window"
  599. };
  600.  
  601. resource 'MENU' (401, "File") {
  602.     401,
  603.     textMenuProc,
  604.     allEnabled,
  605.     enabled,
  606.     "File",
  607.     {    /* array: 3 elements */
  608.         /* [1] */
  609.         "New", noIcon, "N", noMark, plain,
  610.         /* [2] */
  611.         "Close", noIcon, "W", noMark, plain,
  612.         /* [3] */
  613.         "Quit", noIcon, "Q", noMark, plain
  614.     }
  615. };
  616.  
  617. resource 'MENU' (400, "Apple") {
  618.     400,
  619.     textMenuProc,
  620.     0x7FFFFFFD,
  621.     enabled,
  622.     apple,
  623.     {    /* array: 2 elements */
  624.         /* [1] */
  625.         "About...", noIcon, noKey, noMark, plain,
  626.         /* [2] */
  627.         "-", noIcon, noKey, noMark, 1
  628.     }
  629. };
  630.  
  631. resource 'MENU' (402, "Edit", preload) {
  632.     402,
  633.     textMenuProc,
  634.     0x0,
  635.     enabled,
  636.     "Edit",
  637.     {    /* array: 6 elements */
  638.         /* [1] */
  639.         "Undo", noIcon, "Z", noMark, plain,
  640.         /* [2] */
  641.         "-", noIcon, noKey, noMark, plain,
  642.         /* [3] */
  643.         "Cut", noIcon, "X", noMark, plain,
  644.         /* [4] */
  645.         "Copy", noIcon, "C", noMark, plain,
  646.         /* [5] */
  647.         "Paste", noIcon, "V", noMark, plain,
  648.         /* [6] */
  649.         "Clear", noIcon, noKey, noMark, plain
  650.     }
  651. };
  652.  
  653. resource 'MBAR' (400, "Main MBAR") {
  654.     {    /* array MenuArray: 3 elements */
  655.         /* [1] */
  656.         400,
  657.         /* [2] */
  658.         401,
  659.         /* [3] */
  660.         402
  661.     }
  662. };
  663.  
  664. resource 'DITL' (400, "About") {
  665.     {    /* array DITLarray: 2 elements */
  666.         /* [1] */
  667.         {71, 117, 91, 177},
  668.         Button {
  669.             enabled,
  670.             "OK"
  671.         },
  672.         /* [2] */
  673.         {7, 70, 61, 280},
  674.         StaticText {
  675.             enabled,
  676.             "Starter Application - a place to start y"
  677.             "our Macintosh program."
  678.         }
  679.     }
  680. };
  681.  
  682. resource 'DITL' (401, "Fatal Error") {
  683.     {    /* array DITLarray: 2 elements */
  684.         /* [1] */
  685.         {86, 117, 106, 177},
  686.         Button {
  687.             enabled,
  688.             "Exit"
  689.         },
  690.         /* [2] */
  691.         {5, 67, 71, 283},
  692.         StaticText {
  693.             enabled,
  694.             "Fatal error:  ^0"
  695.         }
  696.     }
  697. };
  698.  
  699. resource 'ALRT' (400, "About") {
  700.     {40, 40, 142, 332},
  701.     400,
  702.     {    /* array: 4 elements */
  703.         /* [1] */
  704.         OK, visible, silent,
  705.         /* [2] */
  706.         OK, visible, silent,
  707.         /* [3] */
  708.         OK, visible, silent,
  709.         /* [4] */
  710.         OK, visible, silent
  711.     }
  712. };
  713.  
  714. resource 'ALRT' (401, "Fatal Error") {
  715.     {40, 40, 156, 332},
  716.     401,
  717.     {    /* array: 4 elements */
  718.         /* [1] */
  719.         OK, visible, sound1,
  720.         /* [2] */
  721.         OK, visible, sound1,
  722.         /* [3] */
  723.         OK, visible, sound1,
  724.         /* [4] */
  725.         OK, visible, sound1
  726.     }
  727. };
  728.  
  729. resource 'STR ' (400, "General Error") {
  730.     "An unrecoverable error occured!"
  731. };
  732.  
  733. resource 'STR ' (401, "System Error") {
  734.     "Need to upgrade to System 7!"
  735. };
  736.  
  737. resource 'STR ' (402, "MENUBAR Error") {
  738.     "Couldn't load the MENU Bar resource!"
  739. };
  740.  
  741. resource 'STR ' (403, "MENU Error") {
  742.     "Couldn't load a MENU resource!"
  743. };
  744.  
  745. resource 'STR ' (404, "WIND Error") {
  746.     "Couldn't load a WIND resource!"
  747. };
  748.  
  749. // End of File