The receiver’s location in the base coordinate system of the associated window.
For non-mouse events the return value of this method is undefined.
With NSMouseMoved and possibly other events, the event can have a nil window (that is, the window property contains nil). In this case, locationInWindow returns the event location in screen coordinates.
In a method of a custom view that handles mouse events, you commonly use the locationInWindow property in conjunction with the NSView method convertPoint:fromView:to get the mouse location in the view’s coordinate system. For example: