home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / programm / 20702 < prev    next >
Encoding:
Internet Message Format  |  1993-01-05  |  1.3 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!spool.mu.edu!agate!dewey.soe.berkeley.edu!werner
  2. From: werner@dewey.soe.berkeley.edu (John Werner)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Detecting mouseDown in a region?
  5. Date: 5 Jan 1993 19:12:50 GMT
  6. Organization: School of Education, U.C. Berkeley
  7. Lines: 20
  8. Message-ID: <1icmjiINN7mf@agate.berkeley.edu>
  9. References: <1993Jan5.171920.29754@fsl.noaa.gov>
  10. NNTP-Posting-Host: dewey.soe.berkeley.edu
  11.  
  12. In article <1993Jan5.171920.29754@fsl.noaa.gov> Art Urban writes:
  13. >
  14. >I have many (let's say 1000) predefined regions in a window (CPane). When
  15. >the user clicks in the window, one of the regions will have neccessarilly
  16. >been hit, since they are all adjacent to one another. I need to determine
  17. >which region was the recipient of the mouseDown.
  18.  
  19. First a couple of questions: Are that many regions really necessary?
  20. Could you use rectangles or some other simple geometric object?  Could
  21. you use fewer?
  22.  
  23. If you really need that many regions, you could try sorting them
  24. somehow, so you don't have to search *all* of them.  If they're small
  25. and/or regularly sized, you could keep a list of them sorted by X or Y
  26. coordinate (or both) and do a sort of a binary search to find the one
  27. that was clicked in.
  28.  
  29. -- 
  30. John Werner                        werner@soe.berkeley.edu
  31. UC Berkeley School of Education    
  32.