Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: list bummers Message-ID: <9105@hoptoad.uucp> Date: 28 Nov 89 21:58:12 GMT References: Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 38 In article es2q+@andrew.cmu.edu (Erik Warren Selberg) writes: >ok, list bummers revised: >what appears to be happening is that my DoContentClick() routine isn't >handling the mouse position correctly. what I'm doing is passing the >FrontWindow and event to the procedure, which is coded thus: > > begin > GlobalToLocal(theEvent.where); > if PtInRect(theEvent.where, tempFile.lWindow^.portRect) & >tempFile.lList.click(theEvent.where, TheEvent.Modifiers) then > begin > > end; > end; > >the problem seems to be that either PtInRect isn't returning true when it's >supposed to, or LClick isn't clicking. I've tried making PtInRect use a >variable gpt that's equal to LocalToGlobal(theEvent.where), as well as passing >countless variations of GlobalToLocal and LocalToGlobal mutations to >both procedures, but both manage to screw up. Any ideas? Both the points should be in local coordinates. However, notice that GlobalToLocal works with references to the curent port, not with respect to the front window. Your comments about how moving the window would make it work lead me to believe that the enclosing code is *not* doing a SetPort to the FrontWindow except in certain circumstances like dragging the window. If you were not setting the correct port before going into the routine shown above, that would explain your problems. Try putting in a "GetPort(save); SetPort(window);" at the beginning of your routine and a "SetPort(save);" at the end (and declare "save:GrafPtr") and see if this makes a difference. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "Prisons are built with stones of Law, Brothels with bricks of Religion." - Blake, "The Marriage of Heaven and Hell"