Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!oberon!sdcrdcf!csun!polyslo!dorourke From: dorourke@polyslo.UUCP (David M. O'Rourke) Newsgroups: comp.sys.mac.programmer Subject: Re: What can you assume about the current port? Message-ID: <2426@polyslo.UUCP> Date: 11 May 88 08:00:37 GMT References: <2799@polya.STANFORD.EDU> Reply-To: dorourke@polyslo.UUCP (David O'Rourke) Organization: Cal Poly State University -- San Luis Obispo Lines: 37 In article <2799@polya.STANFORD.EDU> rothberg@polya.STANFORD.EDU (Edward Rothberg) writes: > >1) What I'm doing is totally bogus, and I should always say SetPort before > drawing into the port. My training has told me this is the correct way to do it. Since your program might have to handle update events in any window, which is in effect, a grafport. The update routine you write should just set the port anyways. So it shouldn't be a problem. You might be drawing into a "non-active" window in which case you should first save the port, set the port, draw the contents, and then restore the old port. Also this is right out of Inside Macintosh Volume I, page 440. Warning: Early versions of some desk accessories may set the current grafport to the accessory's port upon return from OpenDeskAcc. To be safe, you should bracket your call to OpenDeskAcc with calls to the QuickDraw procedures GetPort and SetPort, to save and restore the current port. Since the alarm clock is one of the oldest DA's I can think of, I guess it comes under the catagory of "Early versions of some desk accessories". Hope this helps David M. O'Rourke +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | dorourke@polyslo | Disclaimer: All opinions in this message are mine, but | | | if you like them they can be yours too. | | | Besides I'm just a student so what do I | | | know! | |-----------------------------------------------------------------------------| | When you have to place a disclaimer in your mail you know it's a sign | | that there are TOO many Lawyer's. | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++