Robert Covington wrote: >> I have some weird issue where turning PICTs intoFB buttons never >> resolves from the first press...so if I open a window in response, >> it will never close in response to a Window Close (or it does, but >> you don't see it doing it), the window is constantly rebuilt, I >> think on top of itself. I have verified this by placing a beep and >> delay in the build function. Every time I hit the close button, it >> is rebuilt. This obviously did not occur in FB4. > > > I have verified that in my case the control draw handler is > continuing to get re-called when the window it builds via FN > BuildFindReplaceWnd, is attempted to be closed. > Here's my control draw handler. Since this worked in FB4, not sure > why it is getting re-called over and over again upon the window > close? See hilited text > > long if 0 > "CustomDrawControl" > enterproc fn CustomDrawControl( nextHandler as EventHandlerCallRef, ¬ > theEvent as EventRef, userData as Ptr ) = OSStatus [snip] > long if gFRWndStayBack > wId = FN GetTopDocWndNumber > #if def _FBToC > w = fn MyGetWndPointer(wId) > #else > w = fn FBGetWndPointer(wId) > #endif > Xelse > w = FN FrontNonFloatingWindow > end if Consider replacing that code by w = fn GetControlOwner( c ) [snip] > long if FN WindowExists(_FindReplaceWnd) = _False > // Gets called again and again, if you try to close the window > created from this call. > FN buildFindReplaceWnd > Xelse > window _FindReplaceWnd > end if Code like this should not be in a kEventControlDraw handler. I am surprised that you got away with it in FB4. A draw handler should have no side effects other than the actual drawing. Robert P.