home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!mimsy!mojo.eng.umd.edu!russotto
- From: russotto@eng.umd.edu (Matthew T. Russotto)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Detecting mouseDown in a region?
- Message-ID: <1993Jan05.232933.21283@eng.umd.edu>
- Date: 5 Jan 93 23:29:33 GMT
- References: <1993Jan5.171920.29754@fsl.noaa.gov>
- Organization: Project GLUE, University of Maryland, College Park
- Lines: 27
-
- In article <1993Jan5.171920.29754@fsl.noaa.gov> urban@yoda.fsl.noaa.gov (Art Urban) writes:
- >
- >Okay, here's the situation:
- >
- >I have many (let's say 1000) predefined regions in a window (CPane). When
- >the user clicks in the window, one of the regions will have neccessarilly
- >been hit, since they are all adjacent to one another. I need to determine
- >which region was the recipient of the mouseDown.
- >
- >Am I supposed to loop through all my regions, checking PtInRegion() for
- >each one until I get a hit? This seems very brute force, and could possibly
- >become slow if the user clicks in the 1000th region. Is there any way I can
- >reduce the possibilities?
-
- You've mentioned the traditional way, and I believe one of the few ways
- will work for arbitrary regions. The opposite extreme is to make a
- table mapping points to regions-- takes some setup and is memory
- intensive, but will work.
-
- If you know a little more about where the regions are, you could
- eliminate some of the regions based on, say, which quadrant the mouse
- was clicked on.
- --
- Matthew T. Russotto russotto@eng.umd.edu russotto@wam.umd.edu
- Some news readers expect "Disclaimer:" here.
- Just say NO to police searches and seizures. Make them use force.
- (not responsible for bodily harm resulting from following above advice)
-