On 8/10/19 2:21:05 PM, Rob Petrovec wrote:

On Aug 10, 2019, at 3:12 PM, Kurt Bigler <kkbli...@breathsense.com> wrote:

On 8/10/19 10:03:00 AM, Rob Petrovec wrote:
On Aug 10, 2019, at 12:24 AM, Kurt Bigler via Cocoa-dev 
<cocoa-dev@lists.apple.com> wrote:

The NSView subclasses involved are receiving drawRect: messages but are not 
receiving mouseDown:.

        You need to implement NSView -hitTest: to get mouseDown events.

I have 5 working Cocoa apps, and none implement hitTest.  It is apparently needed 
for special circumstances, per the docs "to have a view object hide mouse-down 
events from its subviews”.
        The OP said NSView subclasses.  Not NSControl.  So he needs to implement 
hitTest to get mouseDown events.  If you read the sentence before the line you 
quoted:  "This method is used primarily by an NSWindow object to determine 
which view should receive a mouse-down event.”.  NSView returns nil from hitTest by 
default, so raw NSViews don’t get mouseDown events.

I am the OP.  :)

I do have on this Mac 5 working Cocoa apps with at least one NSView subclass that receives mouseDown events but does not implement hitTest. In short I have never implemented hitTest, and have always had my NSView subclasses receive mouseDown events. This hybrid app situation is the first exception.

So maybe nil from hitTest has a special interpretation.

-Kurt


—Rob





_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to