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