Re: Converting View Coordinates
Re: Converting View Coordinates
- Subject: Re: Converting View Coordinates
- From: "John C. Randolph" <email@hidden>
- Date: Tue, 15 Jan 2002 22:26:08 -0800
On Tuesday, January 15, 2002, at 10:07 PM, Alex Keresztes wrote:
>
In my project I have my own custom view that overrides the
>
>
- (void)mouseDown: (NSEvent *)theEvent
>
>
so I can handle mouse clicks on that view.
>
>
I can get the screen coordinates on where the mouse was clicked
>
by [theEvent locationInWindow]
>
which returns an NSPoint.
>
>
My question is if there is any way to convert the coordinates
>
from the window coordinates to my
>
custom view's coordinates? I could potentially do this myself
>
but I was wondering if anyone knew of
>
any such functions?
- (void)mouseDown: (NSEvent *)theEvent
{
NSPoint
where = [self convertPoint:[theEvent locationInWindow]
fromView:nil];
// etc.
}
-jcr
"These kids today don't know the simple joy of saving four bytes
of page-0 memory on a 6502" - unknown