Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!usc!apple!jerryg From: jerryg@Apple.COM (Jerry Godes) Newsgroups: comp.sys.mac.programmer Subject: Re: why does a ModalDialog filter proc get empty update events? Keywords: ModalDialog filterproc update empty Message-ID: <3257@internal.Apple.COM> Date: 31 Jul 89 23:25:28 GMT References: <4468@uhccux.uhcc.hawaii.edu> Organization: Apple Computer Inc, Cupertino, CA Lines: 42 In article <4468@uhccux.uhcc.hawaii.edu> mikem@uhccux.uhcc.hawaii.edu (Mike Morton) writes: > >The filterproc passed to ModalDialog sometimes seems to get an endless >stream of update events with an empty event region. Anyone know why? [...] > -- Mike Morton // P.O. Box 11378, Honolulu, HI 96828, (808) 676-6966 HST > Internet: mikem@uhccux.uhcc.hawaii.edu > [Other code deleted] >pascal Boolean dlStdFilter (theDialog, evt, item) > DialogPtr theDialog; EventRecord *evt; short *item; >{ RgnHandle upd; > > if (evt->what == updateEvt) /* anything being updated? */ > { upd = ((WindowPeek) theDialog) -> updateRgn; > > if (! upd) > DebugStr ("\p update event with no handle"); > else if (EmptyRgn (upd)) > DebugStr ("\p empty update"); > else > DebugStr ("\p real update"); > } /* end of handling update event */ > return false; >} /* end of dlStdFilter () */ Mike - What you are forgetting to check is which window the update event is for. I doctored your program to work in MPW, so I could see what was going on in MacsBug. As I thought, the update event you are getting is for the other window. So, to solve your problem, just check the update event for the dialog window, but not for any other windows. My question now is why is an update event being generated for the other window? Maybe I'll go snooping in MacsBug a bit later and see what's going on. Jerry Godes Communications Product Development Apple Computer Inc. (Nothing interesting to add here).