Problems with hitTest and mouseDown in my subview.

  • I'm kind of just starting with Cocoa so please excuse me if this is a
    complete newb question.

    I've got a subview that we'll call superview.  It's got some other
    custom subview that we'll call subviews.  I want to detect mouse
    clicks on my superview - I don't want the clicks to be passed down
    the responder chain to the subviews.  So I implemented hitTest in my
    superview and it returns itself to keep the click from being passed
    down to the subview.  So then in my mouseDown method within the
    superview I handle the click.  But the problem is that the point I
    receive from the mouseDown's NSEvent is always (0, 0).  So I figured
    that maybe I need to convert the point to the superview's local
    coordinate system using:

    NSPoint event_location = [theEvent locationInWindow];
    NSPoint local_point = [self convertPoint:event_location fromView:nil];

    And of course this still returns (0, 0) as the point in superview's
    local coordinate system.  What's going on here and why would I be
    receiving (0, 0)?  Thanks in advance.

    Regards,
    Carter
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today