home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20474 < prev    next >
Encoding:
Text File  |  1992-12-31  |  2.2 KB  |  46 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!nih-csl.dcrt.nih.gov!FAXCSL!FIXER
  3. From: fixer@faxcsl.dcrt.nih.gov (Chris Feelin' Groovy Tate)
  4. Subject: Re: How does my app know that its document was double clicked?
  5. Message-ID: <1992Dec31.154633.25705@alw.nih.gov>
  6. Sender: postman@alw.nih.gov (AMDS Postmaster)
  7. Reply-To: fixer@faxcsl.dcrt.nih.gov
  8. Organization: Computer Systems Laboratory, DCRT, NIH
  9. References: <C04pu0.I5B@netnews.jhuapl.edu>
  10. Date: Thu, 31 Dec 1992 15:46:33 GMT
  11. Lines: 33
  12.  
  13. In article <C04pu0.I5B@netnews.jhuapl.edu>, Robert Jensen <jensen@aplcomm.jhuapl.edu> writes:
  14. >I wrote an application, defined document types, and I can double click on 
  15. >a document created by the application and cause the application to be
  16. >launched.  How does the application know to open the double-clicked 
  17. >document?  I really did study Inside Macintosh, but couldn't figure this 
  18. >out.  Thanks for any hints.
  19.  
  20. Two ways:
  21.  
  22. If your application can deal with AppleEvents (which of course any *proper*
  23. application should :-), then you get an 'odoc' event for each document
  24. double-clicked.  Handle these normally, i.e. as you would any other 'odoc'
  25. event that came down the pike.
  26.  
  27. If your app is *not* AE-aware, you'll get some information passed along to you
  28. at launch time.  You get at this info via the CountAppFiles() routine,
  29. documented in the Segment Loader chapter of IM-II.  CountAppFiles() returns
  30. information about how many documents were double-clicked, along with whether or
  31. not you should be opening them or printing them.  Then, you use GetAppFiles()
  32. and ClrAppFiles() as you wind through the list of double-clicked documents to
  33. get their information and Do The Right Thing.
  34.  
  35. Note: if you do not support AppleEvents, you'll need to figure out for yourself
  36. that you're supposed to quit after you're done printing documents via a Finder
  37. launch.
  38.  
  39. Look on pages 57 and 58 of Inside Macintosh II; this is all explained there.
  40.  
  41. ------------------------------------------------------------------------------
  42. Christopher Tate             | Return of the CryptoSig (tm):
  43. Management Systems Designers |    LR KMBVALMH ZKM HD CNDMH, LV CLYY.  LR
  44.                              |    MDVALMH AKT HDMU CNDMH, BDX'QU DQUNYDDEUJ
  45. fixer@faxcsl.dcrt.nih.gov    |    TDIUVALMH.
  46.