How can I get mouse location when mouseDown?

Discussion in 'Mac Programming' started by MayPeng, Dec 14, 2010.

  1. MayPeng macrumors member

    Nov 21, 2010
  2. Sander macrumors 6502

    Apr 24, 2008
    - (void)mouseDown:(NSEvent *)event
        NSPoint p = [event locationInWindow];
  3. MayPeng thread starter macrumors member

    Nov 21, 2010
    Thank you!
    But I have another problem. The situation is like this: If I put mouseDown code in the NSView's subclass, it will be called. If I put it in the NSWindowController's subclass , it will not be called. Why?
    NSView and NSWindowController are both the NSResponse's subclass, so they should both override super class 's method.

Share This Page