[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
detaching print records
- To: info-mcl@cambridge.apple.com
- Subject: detaching print records
- From: wilcox@cmns.think.com
- Date: Wed, 30 Sep 92 12:53:24 EDT
What is the proper procedure for dealing with detached resources?
I have an application which lets users work on several files simultaneously.
Each file has a resource fork containing the print record for that file.
My strategy for handling various events is:
When a user opens a file, I use get-resource to get a handle to the print
record, then detach it and close the file. Now the print record can be used
to print the file, even if page-setup has not been done.
When the user does page-setup, I do get-resource again, this time leaving the
handle live (undetached). The user modifies it however she likes, after which
I detach the handle and close the file.
When the user prints, I just use the information in the detached print record.
In general, I try to keep the print record detached and the resource file
closed. The only exception is during page setup, when the print record is
being modified.
Is this a good strategy? Is there any sample code (not necessarily in Lisp)
that shows how to do this correctly?