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