Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!uwvax!uwmacc!uwmcsd1!leah!itsgw!batcomputer!pyramid!voder!apple!han From: han@apple.UUCP Newsgroups: comp.sys.mac Subject: Re: changing the defaults in the page setup dialog Message-ID: <956@apple.UUCP> Date: Mon, 8-Jun-87 11:55:48 EDT Article-I.D.: apple.956 Posted: Mon Jun 8 11:55:48 1987 Date-Received: Thu, 11-Jun-87 01:59:32 EDT References: <3654@osu-eddie.UUCP> <933@apple.UUCP> <2234@husc6.UUCP> Organization: Apple Computer, Inc., Cupertino, USA Lines: 128 Keywords: orientation In article <2234@husc6.UUCP>, stew@endor.harvard.edu (Stew Rubenstein) writes: > In article <933@apple.UUCP> han@apple.UUCP (Byron Han) writes: > >In article <3654@osu-eddie.UUCP>, sarrel@osu-eddie.UUCP (Scoop) writes: > >> I am writing a short program that will, as part of its function, print out > >> a standard form. However, the form is 'sideways' on the page. I have the > >> form in a window, but now I want to print it out. I figured the best way > >> to print something sideways is to change the default orientation switch in > >> the Page Setup dialog. > >> > >> What's the best way to do this? Can I just save a copy of the dialog resource > >> (with the switch set the way I want) in the application's resource fork? Is > >> it that easy, or am I hallucinating? I'm not _that_ expierienced a > >> MacProgrammer, so have some mercy with your answers. > >> > >> advTHANKSance > > > >The easiest way is to store the print record. In your program you probably > >have > > hPrint = THPrint(NewHandle(SIZEOF(TPrint))); > > if PrValidate(hPrint) then begin > > end; > > [remainder of this probably irrelevant reply deleted] > > You folks are missing the point, I think. Read Scoop's message again. > He is asking the same question thousands of Macintosh developers have > asked before, "How do I change or override the Standard Print Dialogs?" > In this case, he wants the dialog to default to landscape mode. > > The right way to do this would be a SetRotn opcode to the new > PrGeneral procedure. Unfortunately, Apple forgot to implement > this. I hope it was only a correctable oversight. > > Apple's response has always been, "Don't do this. Let the user select > the desired options from the standard dialogs." Quoting from TN 122: > > Summary > > To be compatible with future printer-like devices, it is essential > that your application print in a device-independant manner. Avoid > testing undocumented fields, setting fields in the print record > directly and bypassing the existing print dialogs. Use the Printing > Manager dialogs, PrintDefault and PrValidate to set up the print > record for you. > > There is great virtue in consistency; I am certainly a big fan of the > consistent Macintosh user interface and regard the User Interface > Guidelines as gospel. However, the lack of a programmatic interface > to the print manager is a longstanding deficiency. In recent > TechNotes, Apple has sactioned methods to add to Print Dialogs (TN 95) > and added some further print manager functions (TN 128). One of the > added functions is the GetRotn opcode to PrGeneral, which will let you > test whether the user has selected Landscape mode, after the fact. So > the best you can do, if you want to be compatible with future printer > drivers, is put up a window saying, "Please select Landscape Mode" > along with the standard Style Dialog, and then issue an error or > warning message if Landscape mode has not been selected. > > In my opinion, this looks like a real kludge to the end user; it's > confusing and it's unnecessarily time consuming. The PrGeneral call > is a step in the right direction, but it's not complete. Please add a > SetRotn opCode to the next release of PrGeneral. > > Stew Rubenstein > Cambridge Scientific Computing, Inc. > UUCPnet: seismo!harvard!rubenstein > Internet: rubenstein@harvard.harvard.edu > CompuServe: 76525,421 > MCIMail: CSC > Stew Rubenstein > Cambridge Scientific Computing, Inc. > UUCPnet: seismo!harvard!rubenstein > Internet: rubenstein@harvard.harvard.edu > CompuServe: 76525,421 > MCIMail: CSC The result of my reply was indeed relevant. If you had bothered to read it, you would have realized it was. By following the techniques I described, you then will have a print dialog which would default to whatever the programmer wants. One allocates a default print record, validates it, and then via the standard Style dialog (Page Setup) sets the attributes desired. This is then written out to the document's resource fork as a user defined resource. Upon launch of the application, the application checks the document for a print record under the user defined resource type and then uses it. The print record read in contains the defaults desired - which not only include orientation, but page size, special effects such as tall adjusted, reduction, or gaps between pages. Thereby, when the user brings up Page Setup, the proper defaults are already selected. It would be a simple matter to write a small program which creates a default print record with the Apple defaults, uses the PrStlDialog routine to set the defaults desired, and then writes out a custom resource to a target file. This would work independent of any printer driver and works with many different attributes. In my opinion, this is a close to Apple kosher as one can get. We go through standard dialogs for printing for a reason. It is to provide a common interface. I dislike Microsoft Word 3.0 for this very reason. It is non standard. I have written printing code where it was desirable to bypass the PrJobDialog on each job (it was a high frequency printing application, with little or no chance in job parameters on each job). It was easily done and did not involve massive programming convolutions. But this should only be done in certain circumstances that warrant it. And there was also a facility to force a PrJobDialog (holding down the mouse button when executing the Print command) But it is important to realize that the *user* is in control and should have the ultimate last word. That is what lies behind the Apple user interface. ===================================================================== Byron Han | UUCP: {sun,voder,nsc,mtxinu,dual}!apple!han Apple Computer, Inc. | CSNET: han@apple.csnet 20525 Mariani Ave, | ATTNet: 408-973-6450 Cupertino, CA 95014 | GENIE: BYRONHAN MS 27Y | CSERVE: 72167,1664 ===================================================================== All opinions and statements do not necessarily represent those of my employer, Apple Computer Inc. =====================================================================