I have a custom subclass of NSView in my app. I would like to know the exact point in the view, relative to it's origin, that was clicked with the mouse. (i.e. Not relative to the Window origin, but relative to the custom-view origin).
I have always used this, which has worked perfectly:
-(void)mouseDown:(NSEvent *)theEvent
{
NSPoint screenPoint = [NSEvent mouseLocation];
NSPoint windowPoint = [[self window] convertScreenToBase:screenPoint];
NSPoint point = [self convertPoint:windowPoint fromView:nil];
_pointInView = point;
[self setNeedsDisplay:YES];
}
But now I get a warning that convertScreenToBase is deprecated and to use convertRectFromScreen instead. However I cannot get the same results from convertRectFromScreen, and anyway, I'm interested in a point, not a rect!
What should I use as the correct replacement for the deprecated code above? Thanks in advance!
I found the solution: