home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!rsg1.er.usgs.gov!ornl!utkcs2!strickli
- From: strickli@cs.utk.edu (Michael C. Stricklin)
- Newsgroups: comp.sys.mac.programmer
- Subject: color dialogs
- Date: 20 Aug 92 19:41:18 GMT
- Organization: University of Tennessee, Knoxville - CS Department
- Lines: 45
- Message-ID: <l97tauINN2nl@utkcs2.cs.utk.edu>
- NNTP-Posting-Host: duncan.cs.utk.edu
-
-
- Is it honestly true that there is no trap to load a color dialog
- box from a resource? My superior intuitive skills tell me that it
- would be called 'GetCDialog,' but I can't find reference to it in
- any of the IM's, or any of Thimk (sic) C's header files. Regardless,
- could anyone tell me what's wrong with this snippet below? It will
- allocate the dialog properly, and (with ShowWindow, SetPort, and
- ModalDialog calls) display the dialog properly in 16 million+
- beautiful colors. Unfortunately, when I try to call it a second time,
- it bombs out during the NewCDialog call. Am I allocating memory
- improperly? I'm running Think C 5.0.2, Sys 7 on a Quadra 900 ( regretably
- not mine :-[....).
-
- void MyDialog( void ) {
- Handle theDITLHandle;
- DialogPtr dialog;
- DialogRecord theDialog;
- Rect theRect = { 40, 40, 252, 634 };
- Boolean dialogDone;
-
- theDITLHandle = GetResource( 'DITL', 128 );
-
- dialog = NewCDialog( &theDialog, &theRect, "\p", false,
- dBoxProc, (WindowPtr)-1L, false, 128, theDITLHandle );
-
- ShowWindow( dialog );
- SetPort( dialog );
- while( ! dialogDone ) {
- ModalDialog( nil, &itemHit );
- if ( itemHit == ok )
- dialogDone = true;
- }
-
- DisposDialog( dialog );
-
- return;
- }
-
-
- This should be boilerplate Mac programming, but I can't get it to
- work. Any help would be appreciated.
-
- Michael C. Stricklin
- mcs@memws.ssd.ornl.gov
- strickli@cs.utk.edu
-