home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / mac / programm / 12844 < prev    next >
Encoding:
Internet Message Format  |  1992-07-22  |  1.4 KB

  1. Path: sparky!uunet!darwin.sura.net!mips!pacbell.com!network.ucsd.edu!ucsbcsl!mcl!scott
  2. From: scott@mcl.ucsb.edu (Scott Bronson)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: DLOG stuff....
  5. Message-ID: <scott.711783028@mcl>
  6. Date: 22 Jul 92 05:30:28 GMT
  7. References: <1992Jul16.150931.27139@gmuvax2.gmu.edu> <144bvfINN8l6@agate.berkeley.edu> <scott.711532425@mcl>
  8. Sender: news@ucsbcsl.ucsb.edu
  9. Lines: 29
  10.  
  11. In <scott.711532425@mcl> scott@mcl.ucsb.edu (Scott Bronson) writes:
  12.  
  13. >I like to make the DITL for the DLOG consist of only one item: a PICT
  14. >resource that covers the entire dialog.  Make sure the item is enabled.
  15. >Then, your about code looks like this (clean and concise):
  16.  
  17. >            dp = GetNewDialog( 131, nil, (WindowPtr)-1L );
  18. >            if( dp ) ModalDialog( nil, &i );
  19. >            DisposeDialog( dp );
  20.  
  21. >Dunno why more people don't use this technique...  If you want to be fancy,
  22. >you might pass a filterProc that will check for hitting keys to dismiss
  23. >the dialog also --  but that's left as an excersice for the reader.
  24. I'll tell you why more people don't use my EXACT technique.  It's
  25. got a glaring bug that I didn't notice until just now.  I'm suprised
  26. no one else on the net caught me doing this.
  27.  
  28. Do you see the bug?  The above code should read:
  29.  
  30.            dp = GetNewDialog( 131, nil, (WindowPtr)-1L );
  31.            if( dp ) {
  32.                ModalDialog( nil, &i );
  33.                DisposeDialog( dp );
  34.            }
  35.  
  36.  
  37. A rather embarassed...
  38.  
  39.     - Scott
  40.