Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!daveg From: daveg@Apple.COM (David Green) Newsgroups: comp.sys.mac.programmer Subject: GlobalToLocal fails Message-ID: <35161@apple.Apple.COM> Date: 1 Oct 89 20:49:22 GMT Reply-To: daveg@apple.com (David Green) Distribution: usa Organization: Apple Computer Inc, Cupertino, CA Lines: 38 I'm having trouble using GlobalToLocal in a simple desk Accessory I'm writing. Upon getting the mousedown event, I set the port to that in the eventMessage. (hopefully the DA's port, is this always true?) At this point I drop into Macsbug and view the point in the eventRecord's Where field. It is in Global coordinates as I tested it out moving the window around and checking the various values. I then pass this point to GlobalToLocal and it comes back garbaged. Has anyone had troubles with Global to local before? This seems trivial, but I have been away from coding so long that it is stumping me. Here is the code that processes the event: if (theEvent->what == mouseDown) { myWindow = (WindowPtr) theEvent->message; SetPort(myWindow); /* use the port of the DA */ foo = theEvent->where; Debugger(); GlobalToLocal(&foo); /* convert to local axes */ Debugger(); if (PtInRect(foo,&globals->listBox)) SysBeep(1); Thanks much for any help in advance. This problem seems so straightforward that I am having trouble seeing it. Frustration is quickly settling in.... Dave -- Disclaimer: The above is all me and has no correlation to Apple policy. ****************************************************************************** * * * * Dave Green * Scratch that, reverse it. * * daveg@Apple.com * Willie W * * * * ******************************************************************************