Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!rochester!pt.cs.cmu.edu!andrew.cmu.edu!rj0z+ From: rj0z+@andrew.cmu.edu (Robert George Johnston, Jr.) Newsgroups: comp.sys.mac.programmer Subject: Calling WDefProcs Manually Message-ID: Date: 22 Mar 89 00:06:49 GMT Organization: Class of '91, Carnegie Mellon, Pittsburgh, PA Lines: 37 Here's an interesting problem. Suppose you are calling FindWindow to determine the window and part of a window that was clicked after getting a mouseDown event. One would call (in LSC): WindowPart = FindWindow(TheEvent->where, &TheWindow); You may then determine if the title bar of a window was clicked upon by simply: if (WindowPart == inDrag) ... Unless the window that was clicked on is a DA window, then the above statement is false, because (WindowPart == inSysWindow). The problem is that I need to determine if the title bar of a window was clicked regardless if it is an application's window, or a system window (DA). I devised the following solution, but it does not work. Consider: if (WindowPart == inSysWindow) { VarCode = GetWVariant(TheWindow); Result = CallPascalL(VarCode, TheWindow, wHit, TheEvent->where, *((WindowPeek) TheWindow)->windowDefProc); ... } Result is defined as a long, and VarCode is an int. The theory behind this statement is that I will call the windowDefProc myself, passing all of the neccessary information to it, and it will tell me if the title bar (dragRgn) was hit. Problem: Result is always zero (0). This is especially confusing to me because the reason that this statement is called is because the event detected a mouseDown in a window, and then the windowDefProc turns around and says that the window was NOT hit. Anybody have any idea why this is not working? Thank you. Rob Johnston.