home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / programm / 14370 < prev    next >
Encoding:
Internet Message Format  |  1992-08-22  |  1.7 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!rsg1.er.usgs.gov!ornl!utkcs2!strickli
  2. From: strickli@cs.utk.edu (Michael C. Stricklin)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: color dialogs
  5. Date: 20 Aug 92 19:41:18 GMT
  6. Organization: University of Tennessee, Knoxville - CS Department
  7. Lines: 45
  8. Message-ID: <l97tauINN2nl@utkcs2.cs.utk.edu>
  9. NNTP-Posting-Host: duncan.cs.utk.edu
  10.  
  11.  
  12. Is it honestly true that there is no trap to load a color dialog
  13. box from a resource?  My superior intuitive skills tell me that it
  14. would be called 'GetCDialog,' but I can't find reference to it in
  15. any of the IM's, or any of Thimk (sic) C's header files.  Regardless,
  16. could anyone tell me what's wrong with this snippet below?  It will
  17. allocate the dialog properly, and (with ShowWindow, SetPort, and 
  18. ModalDialog calls) display the dialog properly in 16 million+
  19. beautiful colors.  Unfortunately, when I try to call it a second time,
  20. it bombs out during the NewCDialog call.  Am I allocating memory
  21. improperly?  I'm running Think C 5.0.2, Sys 7 on a Quadra 900 ( regretably
  22. not mine :-[....).
  23.  
  24. void  MyDialog( void ) {
  25.     Handle        theDITLHandle;
  26.     DialogPtr    dialog;
  27.     DialogRecord    theDialog;
  28.     Rect        theRect = { 40, 40, 252, 634 };
  29.     Boolean        dialogDone;
  30.  
  31.     theDITLHandle = GetResource( 'DITL', 128 );
  32.  
  33.     dialog = NewCDialog( &theDialog, &theRect, "\p", false,
  34.         dBoxProc, (WindowPtr)-1L, false, 128, theDITLHandle );
  35.  
  36.     ShowWindow( dialog );
  37.     SetPort( dialog );
  38.     while( ! dialogDone ) {
  39.         ModalDialog( nil, &itemHit );
  40.         if ( itemHit == ok )
  41.             dialogDone = true;
  42.     }
  43.  
  44.     DisposDialog( dialog );
  45.  
  46.     return;
  47. }
  48.  
  49.  
  50. This should be boilerplate Mac programming, but I can't get it to
  51. work.  Any help would be appreciated.
  52.  
  53. Michael C. Stricklin
  54. mcs@memws.ssd.ornl.gov
  55. strickli@cs.utk.edu
  56.