Drag from view with nested view content

  • I have a custom view that contains other views, yet I want to initiate a drag
    from the entirety of the top view (command clicking anywhere within the top
    view starts a drag).  What is the easiest/simplest way to marshall all the
    mouseDown handling to get this to happen?  Do I need to override mouseDown:
    with all the interior views and pass control up to the superview?  Some of
    the interior views need to respond to clicks.  Command clicks would start a
    drag.

    Ron Anderson
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
  • On Thursday, May 1, 2003, at 03:42  PM,
    <cocoa-dev-request...> wrote:

    > I have a custom view that contains other views, yet I want to initiate
    > a drag
    > from the entirety of the top view (command clicking anywhere within
    > the top
    > view starts a drag).  What is the easiest/simplest way to marshall
    > all the
    > mouseDown handling to get this to happen?  Do I need to override
    > mouseDown:
    > with all the interior views and pass control up to the superview?
    > Some of
    > the interior views need to respond to clicks.  Command clicks would
    > start a
    > drag.

    You should override the hitTest: method (declared in NSView) in your
    top view.  This method is called to determine which view a mouse event
    should be sent to.  If you want to hide clicks from the subviews in
    some instances, just return self in those cases, and return [super
    hitTest:theEvent] in others.

    --
    Brian Webster
    <bwebster...>
    http://homepage.mac.com/bwebster
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
previous month may 2003 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