Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!think.com!spool.mu.edu!sdd.hp.com!usc!zaphod.mps.ohio-state.edu!ncar!news.miami.edu!umiami!gv9b2c9z From: gv9b2c9z@umiami.ir.miami.edu (Ordinary Man) Newsgroups: comp.sys.mac.programmer Subject: Re: Mouse Location Message-ID: <1991Jan31.153307.7732@umiami.ir.miami.edu> Date: 31 Jan 91 20:33:07 GMT References: <0bdWARO00UhW04iF8J@andrew.cmu.edu> Organization: Univ of Miami IR Lines: 34 In article <0bdWARO00UhW04iF8J@andrew.cmu.edu>, rg2c+@andrew.cmu.edu (Robert Nelson Gasch) writes: > Does anybody out there know how to access the location of a mouseclick? > In a program I'm writing, I'm displaying some graphics and depending > on which part of the picture the user clicks on, I'd like to take > appropriate action. If anybody knows the code to access the location > of a mouse click (preferrably in C), please forward me a copy. All you really have to do is call: Point mouseLoc; GetMouse(&mouseLoc); ... which returns in mouseLoc the current location of the mouse (whether the button was clicked or not) in LOCAL coordinates. I once made the mistake off calling GlobalToLocal on mouseLoc which is obviously unnecessary. Remember, the local coordinates are of the current GrafPort and mouseLoc is of type Point. > Thanx alot --> Rob No problem, ==Dan -- /-------------------------------------------------------------------------\ | Dan Weisman - University of Miami - Florida | || || || || | |--------------------------------------------------| || || ||\ /|| | | INTERNET -----> gv9b2c9z@umiami.IR.Miami.edu | || || || | || | | BITNET -----> gv9b2c9z@umiami | ||||||| || | || | |-------------------------------------------------------------------------| | "...bows it's head and prays to the mother of all machines." | \_________________________________________________________________________/