home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!spool.mu.edu!agate!dewey.soe.berkeley.edu!werner
- From: werner@dewey.soe.berkeley.edu (John Werner)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Detecting mouseDown in a region?
- Date: 5 Jan 1993 19:12:50 GMT
- Organization: School of Education, U.C. Berkeley
- Lines: 20
- Message-ID: <1icmjiINN7mf@agate.berkeley.edu>
- References: <1993Jan5.171920.29754@fsl.noaa.gov>
- NNTP-Posting-Host: dewey.soe.berkeley.edu
-
- In article <1993Jan5.171920.29754@fsl.noaa.gov> Art Urban writes:
- >
- >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.
-
- First a couple of questions: Are that many regions really necessary?
- Could you use rectangles or some other simple geometric object? Could
- you use fewer?
-
- If you really need that many regions, you could try sorting them
- somehow, so you don't have to search *all* of them. If they're small
- and/or regularly sized, you could keep a list of them sorted by X or Y
- coordinate (or both) and do a sort of a binary search to find the one
- that was clicked in.
-
- --
- John Werner werner@soe.berkeley.edu
- UC Berkeley School of Education
-