home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / programm / 21937 < prev    next >
Encoding:
Text File  |  1993-01-22  |  1.5 KB  |  40 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!gatech!concert!rock!stanford.edu!eos!data.nas.nasa.gov!taligent!kip-50.taligent.com!user
  3. From: keith@taligent.com (Keith Rollin)
  4. Subject: Re: (Debug) Why am I getting a TRAPV error here?!!
  5. Message-ID: <keith-210193225059@kip-50.taligent.com>
  6. Followup-To: comp.sys.mac.programmer
  7. Sender: usenet@taligent.com (More Bytes Than You Can Read)
  8. Organization: Taligent
  9. References: <1993Jan21.041257.6776@leland.Stanford.EDU>
  10. Date: Fri, 22 Jan 1993 07:00:58 GMT
  11. Lines: 27
  12.  
  13. In article <1993Jan21.041257.6776@leland.Stanford.EDU>,
  14. felciano@summit.stanford.edu (Ramon M. Felciano) wrote:
  15. > I'm jumping into MacsBug on a TRAPV error when I try to use a popup
  16. > menu using my MDEF. I've narrowed it down as far as I can, but my
  17. > assembly isn't strong enough to go any further.
  18. > The error is occuring in a rouine that calculates the screen that has
  19. > the largest intersecting area with the menu's rect. Here's the Pascal
  20. > code excerpt:
  21. >      {***** TRAPV Error after this next line *****}
  22. >      InterArea := (commonRect.bottom - commonRect.top) *
  23. > (commonRect.right - commonRect.left);
  24.  
  25. You're going to have to coerce one of the subtractions into a LONGINT. All
  26. of your values are INTEGERs, and the results of the subtractions and
  27. multiplication will also be an INTEGER. However, the result of the
  28. multiplication can easily exceed the range for INTEGERs (any 256 x 128
  29. window will do). Try the following:
  30.  
  31.     interArea := LONGINT(r.bottom - r.top) * (r.right - r.left);
  32.  
  33. -----
  34. Keith Rollin
  35. Phantom Programmer
  36. Taligent, Inc.
  37.