Re: Turn off background click behavior on a window?
Re: Turn off background click behavior on a window?
- Subject: Re: Turn off background click behavior on a window?
- From: Jonathan Mitchell <email@hidden>
- Date: Wed, 29 Oct 2014 17:17:58 +0000
> On 29 Oct 2014, at 17:08, Steve Mills <email@hidden> wrote:
>
> On Oct 29, 2014, at 11:24:49, Jonathan Mitchell <email@hidden> wrote:
>>
>> Does sound like overkill. I would put together a trivial test project and work back from there.
>
> Same result. New Cocoa app project, subclassed NSView and handled acceptsFirstClick:, which returns NO, set the main window's content view to be that class, and added a button to the content view. Clicking the button while in the background works. I don't see how your test can possibly give you that result. You did have acceptsFirstClick: commented out, and it was returning YES. What happens if you uncomment it and return NO?
>
> If I instead subclass NSButton, set the button's class to that, and return NO from its acceptsFirstClick:, THEN it works.
Sure. This is expected behaviour for NSButton subclasses of NSView.
The docs for NSView acceptsFirstMouse: state:
Override this method in a subclass to allow instances to respond to click-through. This allows the user to click on a view in an inactive window, activating the view with one click, instead of clicking first to make the window active and then clicking the view. Most view objects refuse a click-through attempt, so the event simply activates the window. Many control objects, however, such as instances of NSButton and NSSlider, do accept them, so the user can immediately manipulate the control without having to release the mouse button.
J
_______________________________________________
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