Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!usc!bloom-beacon!bu-cs!dartvax!eleazar.dartmouth.edu!isle From: isle@eleazar.dartmouth.edu (Ken Hancock) Newsgroups: comp.sys.mac.programmer Subject: Re: TrackButton() Message-ID: <14170@dartvax.Dartmouth.EDU> Date: 3 Jul 89 12:17:02 GMT References: <128@dbase.UUCP> <23239@santra.UUCP> <2509@internal.Apple.COM> <23257@santra.UUCP> Sender: news@dartvax.Dartmouth.EDU Reply-To: isle@eleazar.dartmouth.edu (Ken Hancock) Organization: Personal Computing Center, Dartmouth College Lines: 40 In article <23257@santra.UUCP> jmunkki@kampi.hut.fi (Juri Munkki) writes: :> :>Ok. Here's the code I used in my Mandelbrot DA. :> :>/* A general purpose pseudo-button :>** handler. Give it a rect and it :>** handles the rectangle as a button :>** and returns true if the button was :>** hit. :>*/ :>int ClickRect(box) :>Rect *box; :>{ :>register int hilited=0,where; :> Point spot; :> :> while(StillDown()) :> { GetMouse(&spot); :> where=PtInRect(spot,box); :> if(where!=hilited) :> { hilited=where; :> InvertRect(box); :> } :> } :> if(hilited) InvertRect(box); :> :> return hilited; :>} Technically, you should force an invert first since the mouse may be up by the time you arrive at your tracking routine... Ken Ken Hancock '90 | BITNET/UUCP/ Personal Computing Ctr Consultant | INTERNET: isle@eleazar.dartmouth.edu -----------------------------------+---------------------------------------- DISCLAIMER? I don't get paid enough to worry about disclaimers.