home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Frameworks / PennyWise™ Framework / PennyView / Source / ErrorDialog.c < prev    next >
Encoding:
Text File  |  1994-08-08  |  2.1 KB  |  88 lines  |  [TEXT/KAHL]

  1. //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  2. //                                                                                //
  3. //                                                                                //
  4. //                    Copyright PennyWise Software, 1994.                            //
  5. //                                                                                //
  6. //            Part of the PennyWise Software Application Framework                //
  7. //                                                                                //
  8. //                                                                                //
  9. //            ErrorDialog.c            Written by Peter Kaplan                        //
  10. //                                                                                //
  11. //                                                                                //
  12. //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  13. #include "ErrorDialog.h"
  14. #include <PWDialogUtils.h>
  15. //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  16. void    ErrorDialog(short    theID, short theIndex, unsigned char *theOneString)
  17. {
  18. Str255        theErrorString;
  19. WindowPtr    theDialog;
  20. short        itemHit;
  21. GrafPtr        oldPort;
  22.  
  23.  
  24.     GetPort(&oldPort);
  25.     
  26.     GetIndString(theErrorString, theID, theIndex);
  27.     ParamText(theErrorString, theOneString,NULL, NULL);
  28.     
  29.     theDialog = GetNewDialog( kERROR_DIALOG, NULL, (WindowPtr)-1);
  30.  
  31.     if (theDialog) {
  32.         SetDialogDefaultItem( theDialog, kBTTN_OK);    
  33.     
  34.         SysBeep(1);
  35.         ShowWindow    (theDialog);
  36.         SelectWindow(theDialog);
  37.         SetPort        (theDialog);
  38.  
  39.         do {
  40.             ModalDialog( NULL, &itemHit);
  41.         
  42.             }while (itemHit!=kBTTN_OK);
  43.         HideWindow(theDialog);
  44.         DisposDialog( theDialog);
  45.         }
  46.     SetPort(oldPort);
  47. }
  48. //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  49. short    SaveDialog(unsigned char * theString)
  50. {
  51. WindowPtr    theDialog;
  52. short        itemHit;
  53. GrafPtr        oldPort;
  54.  
  55.  
  56.     GetPort(&oldPort);
  57.     
  58.     SetCursor(&qd.arrow);
  59.     if (theString != NULL)
  60.         ParamText((unsigned char*)theString, NULL,NULL, NULL);
  61.     
  62.     itemHit = 0;
  63.     
  64.     theDialog = GetNewDialog( kSAVE_DIALOG, NULL, (WindowPtr)-1);
  65.     if (theDialog) {
  66.  
  67.         SetDialogDefaultItem( theDialog, kBTTN_OK);    
  68.         SetDialogCancelItem ( theDialog, kBTTN_CANCEL);
  69.         
  70.         ShowWindow    (theDialog);
  71.         SelectWindow(theDialog);
  72.         SetPort        (theDialog);
  73.     
  74.             do {
  75.                 ModalDialog( NULL, &itemHit);
  76.             
  77.                 }while (itemHit==0);
  78.                 
  79.         HideWindow(theDialog);
  80.         DisposDialog( theDialog);
  81.         }
  82.         
  83.     SetPort(oldPort);
  84.     
  85. return itemHit;
  86. }
  87. //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  88.