Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!cs.utexas.edu!uunet!wugate!wuarchive!swbatl!texbell!sw1e!uucibg From: uucibg@sw1e.UUCP (3929]) Newsgroups: comp.sys.mac.programmer Subject: Re: Saving window position question Message-ID: <1812@sw1e.UUCP> Date: 28 Jul 89 18:27:51 GMT References: <505@suna.CMI.COM> <7889@hoptoad.uucp> <12616@well.UUCP> <7913@hoptoad.uucp> Reply-To: uucibg@sw1e.UUCP (Brian Gilstrap [5-3929]) Distribution: usa Organization: Southwestern Bell Telephone Co Lines: 40 In article <7913@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes: >In article <12616@well.UUCP> wdh@well.UUCP (Bill Hofmann) writes: >>It's actually much easier than that: [a short but somewhat unclear method for saving the size of the current window] > >................... Yes, I and many others are well aware that >rectangles are laid out as two points; .... >................................... However, this kind of typecasting >.. is, in brief, not clearly written. >Much the same could be accomplished this way -- > Point topLeft, bottomRight; > Rect saveRect; > SetPort(window); > SetPt(&topLeft, window->portRect.left, window->portRect.top); > SetPt(&bottomRight, window->portRect.right, window->portRect.bottom); > LocalToGlobal(&topLeft); > LocalToGlobal(&bottomRight); > SetRect(&saveRect, topLeft.left, topLeft.top, bottomRight.right, > bottomRight.bottom); ... Why not simply do: Rect saveRect; ... SetPort(window); saveRect = window->portRect; LocalToGlobal(&saveRect.topLeft); LocalToGlobal(&saveRect.bottomRight); /* Restore the port and go your merry way */ -------------------------------------------------------------------------------- Brian R. Gilstrap ...!{ bellcore!texbell, uunet }!swbatl!sw1e!uucibg One Bell Center +---------------------------------------------------------- Rm 17-G-4 | "Winnie-the-Pooh read the two notices very carefully, St. Louis, MO 63101 | first from left to right, and afterwards, in case he had (314) 235-3929 | missed some of it, from right to left." -- A. A. Milne -------------------------------------------------------------------------------- Disclaimer: Me, speak for my company? You must be joking. I'm just speaking my mind.