Overlapping NSViews and mouseDown Events
Overlapping NSViews and mouseDown Events
- Subject: Overlapping NSViews and mouseDown Events
- From: Thomas Wetmore <email@hidden>
- Date: Wed, 24 Jun 2015 20:44:32 -0400
I am having a problem with NSViews and mouseDown events.
I have defined a custom view (call it CardView) that is an NSOutlineView centered in a slightly larger view used as a border. When displayed, a CardView looks like an index card holding an outline inside a narrow border. There are a few small bezier paths defined in the border that are used as controls; one is used as a resize handle.
If the user clicks in the resize handle the view resizes correctly. If the user clicks in any non-control part of the border, the view becomes draggable and the user can drag it anywhere in the window. All the other control functions also.
I can put as many of these CardViews into a window as I like, overlap them anyway I like, and they all drag around fine and they all resize fine.
EXCEPT FOR ONE THING, and I haven’t been able to find any help from the docs or from Googling:
When I click in the BORDER area of a CardView, and the click spot happens to be OVER an OUTLINE part of an UNDERLYING CardView, the UNDERLYING NSOutlineView gets the mouseDown event instead of border of the top CardView (“top” here is defined as the CardView that is first in the list of subviews of the Window’s content view). However, if I click in the outline area of the CardView on top, regardless what other CardViews are under that CardView, the top outline view always gets the mouseDown as it should.
So I have a view in which one of the subviews seems to work fine with respect to mouse events, but the border subview around it seems to be invisible to the event system.
How do I make the border areas visible to the window when it decides where to dispatch the mouse events? Does anyone have any advice? Thanks.
Tom Wetmore
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden