Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!dlyons From: dlyons@Apple.COM (David Lyons) Newsgroups: comp.sys.apple Subject: Re: HELP With RODENTS AND WINDOWS ON //GS Message-ID: <31986@apple.Apple.COM> Date: 30 May 89 17:56:43 GMT References: <8905290010.AA26741@decwrl.dec.com> Organization: Apple Computer Inc, Cupertino, CA Lines: 71 In article <8905290010.AA26741@decwrl.dec.com> shatara@memit.dec.com (Chris: 223-8753, TECHNOLOGY OFFICE, MLO1-4/T35) writes: >[...] > For example... I'll click the mouse on a particular area of > the window and get the following coordiantes: > Local X = 415 Global X = 575 > Local Y = 115 Global Y = 185 How did you calculate these values? I assume the globals ones came right out of the record you passed to TaskMaster, but where did you get the local values? > Scrolling the window 15 pixels and clicking the mouse on the > same location ON THE WINDOW yields the same results, > even though the point on the "PICTURE" I was pointing to has > moved UP 15 PIXELS. > > I've tried using the LOCALTOGLOBAL call to convert the location > returned from GETMOUSE to global coordinates, but this doesn't > help since the origin of window is always 0,0. Why do you want to convert back to global coordinates? GetMouse already goes to the trouble of converting to local coordinates for you. If you want global coordinates, just get the value out of your event record. > I've also tried using the STARTDRAWING call with the same result. > I think the problem here is I'm using taskmaster to tell me of > mouse activity and its probably resetting the origin to 0,0. StartDrawing before a GlobalToLocal is perfectly reasonable. (You should SetOrigin(0,0) on your port before you call TaskMaster again.) Note that StartDrawing sets the origin the same way you could by using SetOrigin on the result of GetContentOrigin, and that a window's origin should normally be (0,0) when you aren't doing anything with it. > Related question..if I have an info bar of say a height of 30, > when a mouse is in the info bar area, the coordinates returned are > what (local, global, local to what?) I believe you get global coordinates, which you should compare against the info bar rectangle (get it with GetRectInfo). > I have also had a problem generating a window with an information > bar in it. I would set the wFRAMEBITS bit-4 to 1 to signify that > I want an info bar. I have the wINFODEFPROC pointing to a > procedure which does nothing! (begin, end) and I have the height > set to 20 (wINFOHEIGHT). When the window is drawn, the info bar > is there, no title is written, scroll bars do not work and the > program appears to be hung although I still can move the pointer. > > Resetting bit 4 of wFRAMEBITS clears up the probelem so it > appears to be somehow related to the Ident bar. Exactly how did you declare the parameters to your info bar routine? It's important that it have exactly 12 bytes of input parameters, even if it doesn't do anything, since the procedure needs to remove these bytes from the stack before returning. (The compiler takes care of that, but you have to declare the parameters.) Try something a lot like this: procedure MyInfoDraw(var infoRect: rect; infoData: longint; window: GrafPtr); --Dave Lyons, Apple Computer, Inc. | DAL Systems AppleLink--Apple Edition: DAVE.LYONS | P.O. Box 875 AppleLink--Personal Edition: Dave Lyons | Cupertino, CA 95015-0875 GEnie: D.LYONS2 or DAVE.LYONS CompuServe: 72177,3233 Internet/BITNET: dlyons@apple.com UUCP: ...!ames!apple!dlyons My opinions are my own, not Apple's.