How can I get mouse location when mouseDown?

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

  1. MayPeng macrumors member

    Joined:
    Nov 21, 2010
  2. Sander macrumors 6502

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

    Joined:
    Nov 21, 2010
    #3
    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