Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!well!wdh From: wdh@well.sf.ca.us (Bill Hofmann) Newsgroups: comp.sys.mac.programmer Subject: Re: GlobalToLocal() LocalToGlobal() information Message-ID: <23417@well.sf.ca.us> Date: 1 Mar 91 19:46:03 GMT References: <3744.27CD13AE@stjhmc.fidonet.org> Organization: Whole Earth 'Lectronic Link, Sausalito, CA Lines: 14 In article <3744.27CD13AE@stjhmc.fidonet.org> Chris.Gehlker@p12.f56.n114.z1.fidonet.org (Chris Gehlker) writes: >GW> This LocalToGlobal() translation is simply addition or subtraction >GW> from some reference point (window location in global coordinates). >GW> This information is contained in the WDEFResource boundsRect >GW> element, but I don't know where it goes during the GetWindow( >GW> ) function call. Where is this reference point stored? (structure? >GW> element?). >I think the calls just juse the Window Manager Port. Nope. Look at the window's portBits.bounds. This is the coordinates of the main screen in the coordinate system of the window. Thus, to convert from local to global, just subtract the top,left of portBits.bounds, and to convert from global to local, just add the top,left of portBits.bounds. This is what LocalToGlobal and GlobalToLocal do. -Bill Hofmann