Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: why does a ModalDialog filter proc get empty update events? Message-ID: <8193@hoptoad.uucp> Date: 1 Aug 89 00:26:02 GMT References: <4468@uhccux.uhcc.hawaii.edu> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 39 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? I don't know what an event region is. Do you mean that your dialog window's update region is empty? If that's so, then the update event must be for another window. Have you checked to see if the update event is for your window or not? >This is annoying, because I'd like to use update events to redraw the >outline around the default item, making sure that the item reappears >if a screen-saver or nested dialog obscures it. The correct way to do this is to create a disabled user item which surrounds the button four pixels out, then bind to that item a drawing procedure which does a FrameOval on the item rectangle. (It may also be possible to just set the default button field in the DialogPeek, but I haven't tried that yet.) >I can check for the case where the update region is empty, and avoid >doing updating (thus avoiding some cursor flickering) but I'm curious >about why these events come in. The code below is a full application >which demonstrates the phenomenon. If I take out a NewWindow call >(see below), the update events stop. This demonstrates that the update events are for the other window. You should either service the events as normal for the other window, or ignore them inside your filter procedure. > if (evt->what == updateEvt) /* anything being updated? */ > { upd = ((WindowPeek) theDialog) -> updateRgn; Try adding: if ((DialogPtr)(evt->message) != theDialog) return false; -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "Gorbachev is returning to the heritage of the great Lenin" - Ronald Reagan