Article View: comp.sys.mac
Article #16593Re: changing the defaults in the page setup dialog
From: han
Date: Fri, 05 Jun 1987 16:52
Date: Fri, 05 Jun 1987 16:52
62 lines
3207 bytes
3207 bytes
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;
After calling PrStlDialog(hPrint) to get the proper defaults, you will then
probably want to write it out to the resource fork of the application.
Note that self-modifying applications (changing your own resource fork)
is not really smiled upon - makes your program not completely Appleshare
compatible (i.e. you cannot be a shared application ready for multiple
launches).
So to write it out to the resource fork, make sure that the top resource
file is the application (or document) file, and then call
AddResource(Handle(hPrint), 'XXXX', theID, 'Resource Name');
where theID is an integer, and XXXX is the resource type. Note that there
are many pre-defined resource types which you will want to stay away from.
And all lower-case resource types are reserved by Apple.
Thereafter, when you launch your program, it should check to see if your
custom print record resource is there, if not, it should go through the
creation of a fresh print record, validation, etc...
Otherwise, read it the resource via
hPrint = THPrint(GetResource('XXXX', theID))
and you should be on your way.
Hope this helps.
=====================================================================
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.
=====================================================================
Technical Details
Message-ID:
<933@apple.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!husc6!think!ames!oliveb!pyramid!voder!apple!hanReferences:
<3654@osu-eddie.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!husc6!think!ames!oliveb!pyramid!voder!apple!han From: han@apple.UUCP Newsgroups: comp.sys.mac Subject: Re: changing the defaults in the page setup dialog Message-ID: <933@apple.UUCP> Date: Fri, 5-Jun-87 12:52:46 EDT Article-I.D.: apple.933 Posted: Fri Jun 5 12:52:46 1987 Date-Received: Sat, 6-Jun-87 19:37:02 EDT References: <3654@osu-eddie.UUCP> Organization: Apple Computer, Inc., Cupertino, USA Lines: 62 Keywords: orientation Summary: changing defaults in print dialogs